private static bool IsBulitinType(Type type)
{
return (type == typeof(object) || Type.GetTypeCode(type) != TypeCode.Object);
}
在网上看到老外写的这个,但是个人认为这个是有问题的,先记录下,后期验证
验证了下,应该是没有问题的
我接上面的方法写了一个判断是不是自定义类型
private static bool IsCustomType(Type type)
{
return (type !=typeof(object) && Type.GetTypeCode(type) == TypeCode.Object);
}
判断是不是集合
bool IsEnumerableType(Type type)
{
return (type.GetInterface("IEnumerable") != null);
}