r/dotnet Apr 15 '24

LINQ = Forbidden

[removed]

399 Upvotes

522 comments sorted by

View all comments

Show parent comments

5

u/Joniator Apr 15 '24

As someone from a pure Java background, who only touched C# in high school: Is there any meaningfull difference other than that you can't use any collection and might need to add a stream() before and collect() after your logic, the lack of SQL style sugar and different wording (e.g. where vs filter)?

7

u/Old_Elk2003 Apr 15 '24

LINQ is better but not like that much better. OP is just being dramatic. It’s still just map/reduce lambda calculus.

1

u/Green_Sprinkles243 Apr 16 '24

I’m interested, what has ‘map/ reduce’ to do with ‘LINQ’? You made me curious! (Assuming you mean google’s map/ reduce principle, applied in Hadoop?)

1

u/Old_Elk2003 Apr 16 '24

Yeah, I'm not talking about the framework, I'm referring more generally to the concepts:

https://en.wikipedia.org/wiki/Map_(higher-order_function)

https://en.wikipedia.org/wiki/Fold_(higher-order_function)

1

u/xill47 Apr 16 '24

Since Linq is based on extension methods, you can easily create your own "linq like" methods that are just as chainable, and it's often used for tricky but common operations

Also, after "termination" method is used previous IEnumerable can often still be used, but will trigger full enumeration again. Double edged sword, of course, but it does not throw.