Why You Should Write Tall LINQ Queries In C# #shorts

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Did it already. It helps a lot. In some IDEs there is even a refactoring for it.

nothingisreal
Автор

You're my man with these suggestions. Great

SKglitches
Автор

Wait a minute. But there're 2 dots in the second line now

TheMagenAlex
Автор

Adding line breaks, making readable code is also telling something about the developer, so I prefer if the developer does that, not a tool.

balazs.hideghety
Автор

You don't have to use all of the horizontal space, but at least few dots per line would be better. You sacrifice method readability for linq readability. It's a personal preference of course. Because when you try to read some big method, you will have to scroll up and down(or page up page down) like crazy while you could see many things in a single page.

forgeteverythingelse
Автор

Is more of personal preference.
I would argue the file length will increase and i have to scroll more

clashclan
Автор

I totally agree with this. Even though I often violate the rule

davidemmanuel
Автор

Is there a way to break a long line to multiple lines for display. Like if I have a very long string and it has to be in one line and I want it to fit to the screen so I dont have to scroll to the right to read it. Does Visual Studio has a setting for that kind of display?

vuhoang
Автор

No hay alguna forma de configurarlo con el formateo automático de visual studio o alguna extensión?

tronic
Автор

In VSCode Csharpier extension does that automatically

bugadada
Автор

Yes, that's good idea, always do the same.
But what you think about nested queries ?
I'd to managed code with up to 4 levels of nested linq queries, and it was a real pain to understand what this code does.

Aios
Автор

Great advice! Could you talk about how to insert line breaks while debugging? Thanks 👍

uzayrsyed
Автор

context.Animals
...
or
context
.Animals
...
Which is better?

noss
Автор

It gets even better if written with LINQ-to-SQL syntax, which is shorter and avoids the multiple 'animal' declaration..
from animal in context.Animals
where animal.HasBigEars
orderby animal.IsDangerous descending
select new AnimalResponse …

nagarajansubramani
Автор

You need to set fixed line, where ide or tool you're using, telling you - it's time to stop.

kirbulich
visit shbcf.ru