Presented without comment.



  • List<MyType> myList = // The non-anonymized code has a LINQ query here.

    if (myList.Count == 0)

        return new List<MyType><mytype>();

    else

        return myList;</mytype>



  • @mott555 said:

    List<MyType> myList = // The non-anonymized code has a LINQ query here.
    if (myList.Count == 0)
        return new List<MyType>();
    else
        return myList;

    Possibly from an older version that looked like....

    List<MyType> myList = // Something that could return List instance or null...
     if (myList == null)
         return new List<MyType>();
     else
         return myList;

     Then a code analysis tool (or fool) did a simple/stupid replace onmce the code was changed to something that could not return null...



  • Or, if it returned a "list with the size of 0", it returned some general created list with always 0 entries that you should not modify or else you edit the "zero list" trough out the whole application.


  • Trolleybus Mechanic

     Obviosuly you return a new list. That first empty list has been tainted by the LINQ's failure to find any records. It would be bad luck to return [b]that[/b] empty list.



  • @mott555 said:

    Presented without comment.

    False. There is a comment on the first line. You clearly have no idea how comments work.



  • @Lorne Kates said:

     Obviosuly you return a new list. That first empty list has been tainted by the LINQ's failure to find any records. It would be bad luck to return that empty list.

    Looks like the typical wastefulness of corporate America. Why reuse this perfectly good list when you can just throw it away and create another? I make my own shoes out of used plastic milk jugs. This kind of thing should be regulated, but the lobbyists for Big List have Washington in their pocket and the sheeple are too busy watching Dancing With The Idols to notice they are being led to the slaughter. I don't own a TV.



  • @morbiuswilters said:

    I make my own shoes out of used plastic milk jugs.
    And that, boys and girls, is how Crocs were invented.



  • @da Doctah said:

    @morbiuswilters said:

    I make my own shoes out of used plastic milk jugs.
    And that, boys and girls, is how Crocs were invented.

     

    At last, I learned something here...

     

     


Log in to reply