# InRange

`ShouldBeInRange` is the inverse of `ShouldNotBeInRange`.

## ShouldBeInRange

```cs
var homer = new Person { Name = "Homer", Salary = 300000000 };
homer.Salary.ShouldBeInRange(30000, 40000);
```

[snippet source](https://github.com/shouldly/shouldly/blob/master/src/DocumentationExamples/CodeExamples/ShouldBeInRangeExamples.ShouldBeInRange.codeSample.approved.cs#L1-L2) | [anchor](#snippet-ShouldBeInRangeExamples.ShouldBeInRange.codeSample.approved.cs)

**Exception**

```
homer.Salary
    should be in range
{ from = 30000, to = 40000 }
    but was
300000000
```

## ShouldNotBeInRange

```cs
var mrBurns = new Person { Name = "Mr. Burns", Salary = 30000 };
mrBurns.Salary.ShouldNotBeInRange(30000, 40000);
```

[snippet source](https://github.com/shouldly/shouldly/blob/master/src/DocumentationExamples/CodeExamples/ShouldBeInRangeExamples.ShouldNotBeInRange.codeSample.approved.cs#L1-L2) | [anchor](#snippet-ShouldBeInRangeExamples.ShouldNotBeInRange.codeSample.approved.cs)

**Exception**

```
mrBurns.Salary
    should not be in range
{ from = 30000, to = 40000 }
    but was
30000
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shouldly.org/documentation/equality/inrange.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
