7

Is it too much LinQ for others devs to get ?

Personally, I don't think so.

Comments
  • 8
    Looks like a less-beautiful ActiveRecord query
  • 1
    @Root this one doesn't access database. Just checking some conditions in 2 levels tree. (No, there will not be 3d level)
  • 7
    .Any().Any().Any().Any....thing at all besides this, please.
  • 6
    You can use your lambda expressions inside those any calls and remove those where calls. It would make it more readable (at least for me). I also tend to use class initials instead of x or xx (p for project and t for task for example) but that's more how I like tk write it.
  • 1
    @Root Well, ended up split it up a little.
  • 1
  • 2
    @dozingncoding RIGHT !

    WHY, WHY I always forget about them ?

    Here.

    Oups missed 1

    It's like a reflex for me to start with Where. Probaly EF4 PTSD
  • 1
    @NoToJavaScript
    Don't worry, I'm used to it. It happens to a lot of people, with both Any and First or FirstOrDefault ;)
  • 1
    @dozingncoding

    *Hisses some air

    Look how sky is blue !

    Same file, 20 lines below
  • 2
    @dozingncoding true, removed 3 surplus where just today and replaced with first and firstordefault.

    Its quite common to use where().first() unfortunately.
  • 1
    @Root far less man. I can't stand LINQ
  • 0
    @AleCx04 In this case I really hope you don’t work with C# !
    I understand the idea of being the sole master of the code and knowing every bit. In my early ages I went to assembler and had fun!
    But do you really want to write 20 lines of code when it can be one? Sure, maybe it will not be the perfect implementation. But, if it is a critical part, you would’ve tested it anyway. For most part, it just works. Just write “whatever” and you get results. Again, if it is too slow, you start to break it down and see “slow” parts. And sometimes fix these parts manually. But it is pretty rare.
  • 1
    @NoToJavaScript barking at the wrong tree here my man. I have worked with C# a lot and plan on doingit again soon . And I should correct myself. I like my linq(yours too btw, it is really readable amd good) but working with some of the weird shit I have seen in the wild makes me prefer people would much rather just take the 20 lines instead of their mess of half assed linq.
  • 0
    On a side note you missed a C in the first contract in the comment
  • 0
    @AleCx04 Truth

    Its like ternaries, if you start having too many of them, I would rather you just stop trying to look savvy and just take the longer approach of splitting it up into several lines.
  • 1
    @AleCx04 true, linq as a concept is very good, but like most powerful concepts it can be abused or twisted beyond usable if the implementer does not grasp the basic idea of it.
Add Comment