Se ho:
List<string> myList1;
List<string> myList2;
myList1 = getMeAList();
// Checked myList1, it contains 4 strings
myList2 = getMeAnotherList();
// Checked myList2, it contains 6 strings
myList1.Concat(myList2);
// Checked mylist1, it contains 4 strings... why?
Ho eseguito codice simile a questo in Visual Studio 2008 e ho impostato i punti di interruzione dopo ogni esecuzione. Dopo myList1 = getMeAList();, myList1contiene quattro stringhe e ho premuto il pulsante più per assicurarmi che non fossero tutti nulli.
Dopo myList2 = getMeAnotherList();, myList2contiene sei stringhe e ho verificato che non fossero null ... Dopo myList1.Concat(myList2);myList1 conteneva solo quattro stringhe. Perché?