Coolest C# LINQ/Lambdas trick you've ever pulled?

后端 未结 14 1459
死守一世寂寞
死守一世寂寞 2020-12-22 17:00

Saw a post about hidden features in C# but not a lot of people have written linq/lambdas example so... I wonder...

What\'s the coolest (as in the most

14条回答
  •  南笙
    南笙 (楼主)
    2020-12-22 17:40

    I think that LINQ is a major change to .NET and it is a very powerful tool.

    I use LINQ to XML in production to parse and filter records from a 6MB XML file (with 20+ node levels) into a dataset in two lines of code.

    Before LINQ this would have taken hundreds of lines of code and days to debug.

    That's what I call elegant!

提交回复
热议问题