比如如下的代码使用三种方式来处理不同类型的数据:ArrayList list = new ArrayList();
list.Add(123);
list.Add("字符串");
list.Add(true);foreach(object obj in list)
{
Console.WriteLine(obj.GetType().Name); if (obj is int)


}
else if (obj is string)


}
else if (obj is bool)


} if (obj.GetType() == typeof(int))


}
else if (obj.GetType() == typeof(string))


}
else if (obj.GetType() == typeof(bool))


}
}