Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Some random C# extension methods I've found useful. Published as Ardalis.Extensi

- [Installation](#installation)
- [Usage](#usage)
- [Enumerable](#enumerable)
- [String checks](#string-checks)
- [Conventions for Contributors](#conventions-for-contributors)
- [Benchmarks](#benchmarks)
Expand All @@ -24,6 +25,22 @@ dotnet add package Ardalis.Extensions

## Usage

### Enumerable

RangeEnumerator allows you to loop over a range of integers up to and including the ending value.

```csharp
// replace
for(var i = 0; i <= 10; i++)

// with
foreach(var i in 0..10)
// or
foreach(var i in ..10)
// or
foreach(var i in 10)
```

### String Checks

IsNull() checks whether a given string is null.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class RangeEnumeratorBenchmarks
[Benchmark(Baseline = true)]
public void NormalForLoop()
{
for (int i = 0; i < End; i++)
for (int i = 0; i <= End; i++)
{
DoNotOptimizeAway(i);
}
Expand Down