Skip to content

Instantly share code, notes, and snippets.

@simonjefford
Last active December 18, 2015 02:58
Show Gist options
  • Save simonjefford/5714641 to your computer and use it in GitHub Desktop.
Save simonjefford/5714641 to your computer and use it in GitHub Desktop.
Getting an index in LINQ
foreach (var exceptionWithIndex in e.InnerExceptions.Select((x, i) => new { Exception = x, Index = i + 1}))
{
this.LogException(string.Format("Exception {0}", exceptionWithIndex.Index), exceptionWithIndex.Exception);
}
@simonjefford
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment