I want to clear my doubt regarding LINQ . I have code like:
val collection = this.Employees.Where(emp => emp.IsActive)
foreach (var emp in collection)
{
// some stuff
}
Now if I write code like this:
foreach (var emp in this.Employees.Where(emp => emp.IsActive))
{
// some stuff
}
will this.Employees.Where(emp => emp.IsActive)
be executed every iteration or it is executed only once?