> For the complete documentation index, see [llms.txt](https://docs.shouldly.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.shouldly.org/documentation/equality/inrange.md).

# 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
```
