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

前端 未结 7 1085
孤街浪徒
孤街浪徒 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

    0 讨论(0)
提交回复
热议问题