SORU
25 HAZİRAN 2009, PERŞEMBE


Nasıl C Listeleri bağlamak mı#?

Eğer var ise:

List<string> myList1;
List<string> myList2;
int placeToCheckValues = 0; //Used for breakpoints since the values don't get updated until after the line is executed

myList1 = getMeAList();
placeToCheckValues = 0;    //Checked myList1 here, it contains 4 strings

myList2 = getMeAnotherList();
placeToCheckValues = 0;    //Checked myList2 here, it contains 6 strings

myList1.Concat(myList2);
placeToCheckValues = 0;    //Checked mylist1 again, it contains 4 strings... why?

Her yürütme sonra Visual Studio 2008 ve set kesme noktaları içinde buna benzer bir kod yaptım. myList1 = getMeAList();, myList1 sonra içerir 4 strings->Tüm boş değerlere değildi emin olmak için artı düğmesine bastım. myList2 = getMeAnotherList();, myList2 sonra içeren 6 dizeleri->myList1.Concat(myList2); myList1 sadece 4 dizeleri yer Sonra boş değildi... emin olmak için kontrol ettim. Bu yüzden mi?

Teşekkürler

CEVAP
25 HAZİRAN 2009, PERŞEMBE


Concat yeni dizi without modifying the original list döndürür. myList1.AddRange(myList2) deneyin.

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • metal571

    metal571

    30 Mayıs 2006
  • POGProductionz

    POGProductio

    27 NİSAN 2012
  • TV nEW

    TV nEW

    25 AĞUSTOS 2012