Skip to content

Instantly share code, notes, and snippets.

@lgolubyev
Created May 23, 2022 12:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lgolubyev/f778e60573a58cce0d5bbe1c37c50475 to your computer and use it in GitHub Desktop.
Save lgolubyev/f778e60573a58cce0d5bbe1c37c50475 to your computer and use it in GitHub Desktop.
public void MyComponentLegacyMethod(List<int> masterCollection)
{
// Without the ToList method this linq query would be executed twice
var result = masterCollection.Where(i => i > 100).ToList();
Console.WriteLine(result.Count());
Console.WriteLine(result.Average());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment