/// <summary> /// 判断一个对像是否是数组 /// </summary> /// <param name="value"></param> /// <returns></returns> public static bool IsArray(object value) { if (value is string) { return false; } if (value is byte[]) { return false; } return value is IEnumerable; }
说明:
主要是使用了 is 的方法来进行判断是否 IEnumerable 类型的