4 ms·
> Almost no one uses the special query syntax Source? I'm in multiple current, active development projects with companies, they are all using the LINQ query sy
by jermaustin1 1y ago
> Almost no one uses the special query syntax
Source? I'm in multiple current, active development projects with companies, they are all using the LINQ query syntax.
Not to mention all of the legacy code out there that is under active maintenance.
To say almost no one feels very much antithetical to my (albeit anecdotal) experience. I can't imagine, I'm the only c# consultant that has multiple clients that use LINQ queries extensively throughout their applications.
- alkonaut 1y agoTrying to crudely estimate the popularity i tried doing a regex search for C# statements ending with select ___; vs calls to Select(/Where(. It was (only) a factor 10x which was way less difference than I thought to be honest. I have seen and used one in the wild just a handful of times during 22 years of C#. But it might also vary with industry. It's likely a lot more common in fields where there are databases than where there are not. [1] https://github.com/search?q=%2F%28%3F-i%29%5Cs%2Bselect%5Cs%2B%5Cw%2B%3B%2F+language%3AC%23&type=code&ref=advsearch [2] https://github.com/search?q=%2F%28%3F-i%29%5Cs%2B%5C.%28Select%7CWhere%29%5C%28%2F+language%3AC%23&type=code&ref=advsearch
- jermaustin1 1y agoI'm actually surprised reading some of those LINQ queries, first few pages, none of them (IMO) should be using query syntax. Hell, I hate query syntax to begin with, and use the extensions any opportunity I'm allowed. But I would also say that the companies using query syntax are also vastly underrepresented on GitHub public repositories. > It's likely a lot more common in fields where there are databases than where there are not. I think beyond that, it's probably more common with developers that came from doing SQL queries but "needed" type safety. I've worked with developers that didn't even know the extension methods existed. They went from SqlCommand to LINQ to EF or LINQ to SQL. The only time I think query syntax is better than the extension methods is when dealing with table joins.
- david_allison 1y ago> The only time I think query syntax is better than the extension methods is when dealing with table joins. Fairly niche, but query syntax is a great approximation of Haskell's do notation: https://github.com/louthy/language-ext/wiki/Thinking-Functionally:-What-is-LINQ-really%3F https://github.com/louthy/language-ext/wiki/Thinking-Functio... EDIT: updated URL