开发者

Has LINQ completely changed the way you code?

Ever since I learned LINQ a couple years ago I have been using it more and more.

I no longer think in loops but rather in projections, selections, etc. Even when I use other languages like Perl, I now find myself making extremely heavy use of things like map and grep. I find that pretty much every single method which has more than 3 lines of code will have LINQ in it in some way. I would say that LINQ has done more to change the way I program than any other language feature I have ever used.

Have you found the same to be true for you? Does anyone avoid using LINQ because they find it hard to understand or write, are banned by their manager from开发者_如何学C using it or any other reason?


I find LINQ highly beneficial. Projecting over a collection saves having to create temporary Lists just to store results. It's also helped me with my functional programming skills.

I'm currently taking a class where the last language we learned was Scheme. I feel strongly that without having done maps and filters through LINQ and lambda expressions, I would have fallen behind in class.

To agree with @Mark, I feel that it certainly make my code more declarative. For example, I want a list of just first names from a Person object. I don't care how it's done (i.e. whether it's a for loop or a while loop, just at the end of the day I have a list of strings instead of Person.


No. It's just another tool.

You really need more than one tool in your tool belt batman.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜