c# 係咪已經冇人用 arrayList?

咁我想問如果store 唔同種類object/data type, 應用那一種?

List<object>  lbobj = new List<object>();
lbobj.add(new obj_1);
lbobj.add(new obj_2);

foreach (object temObj in lbobj)
{
  Console.writeline(temObj...);//自己轉string或其他
}


via HKEPC Reader for Android

TOP

點解會save唔同type既野落同一個list, 正常應該係全部野都係inherit同一個base class or interface

TOP

點解會save唔同type既野落同一個list, 正常應該係全部野都係inherit同一個base class or interface ...
blue01299 發表於 2020-9-10 22:52

因為有D返黎就係object type..

TOP