mirror of
https://github.com/jcreek/Creek.HelpfulExtensions.git
synced 2026-07-12 18:53:45 +00:00
feat(*): Add WithIndex IEnumerable extension
This commit is contained in:
@@ -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())
|
||||
{
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user