Are there any benefits to using a C# method group if available?

前端 未结 7 1133
孤街浪徒
孤街浪徒 2020-12-03 10:55

When dealing with something like a List you can write the following:

list.ForEach(x => Console.WriteLine(x));

7条回答
  •  误落风尘
    2020-12-03 11:33

    No tangible benefits other than making it more pleasant to people who like method groups, and annoy people who dislike them [should that please you.] Also, it makes your code incompatible with earlier compilers.

    -Oisin

提交回复
热议问题