我知道如何枚举一个数组,但是无论类型如何,我该怎么做?
代码:
ViewArray(saClosestVehicles);
public static void ViewArray(object[] ar) {
#region Examples (Quickly display an arrays contents)
// object[] ar = new object[] { "blah", 4, "whatever" };
// ViewArray(ar);
#endregion
string strArrayContents="";
for(int cnt=0; cnt<ar.Length; cnt++)
strArrayContents+=ar[cnt]+" ";
MessageBox.Show(strArrayContents, "Array Contents");
}