feat(*): Add WithIndex IEnumerable extension

This commit is contained in:
Josh Creek
2021-08-27 00:35:18 +01:00
parent 06c6057876
commit 3a63fca25b
4 changed files with 69 additions and 1 deletions
+13
View File
@@ -20,3 +20,16 @@ Whereas, this will result in the string `"fishmandogcat"` as the boolean passed
string s = "bigfishmandogcatdoghat";
s = s.SubstringBetween("fish", "dog", true);
```
## IEnumerable Extensions
### WithIndex
This method allows you to use a foreach loop and easily access the index of each item.
```csharp
foreach (var (item, index) in list.WithIndex())
{
// ...
}
```