Scenarios when to use closures

I played with closing a bit in C # and even wrote them down in applications for specialized applications, but actually nothing shouted to me that this problem should be solved or solved using closing.

Are there any problems when closing is especially useful for solving? Also, is there any bug with closing in C # 4.0?

thank

+3
source share
1 answer

Given that closing is a compiler function, not a platform function, nothing can be done with them.

, (, , , IL, ).

, , LINQ, . :

public List<Person> FilterByAge(IEnumerable<Person> people, int age)
{
    return people.Where(p => p.Age >= age).ToList();
}

, age .

gotchas:

  • .
  • :)
+6

Source: https://habr.com/ru/post/1779061/


All Articles