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

后端 未结 14 1457
死守一世寂寞
死守一世寂寞 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-22 17:45

    Not my design but I've used it a few times, a typed-switch statement: http://community.bartdesmet.net/blogs/bart/archive/2008/03/30/a-functional-c-type-switch.aspx

    Saved me so many if... else if... else if... else IF! statements

提交回复
热议问题