Skip to content

Class TypeHelper ​

Namespace: Tool.Utils
Assembly: Tool.Net.dll

类型助手

csharp
public class TypeHelper

Inheritance ​

object ← TypeHelper

Inherited Members ​

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Extension Methods ​

ObjectExtension.Add<T>(object, object, object), ObjectExtension.CopyEntity(object, object, params string[]), ObjectExtension.EntityToJson(object), ObjectExtension.EntityToJson(object, bool), ObjectExtension.EntityToJson(object, bool, string), DictionaryExtension.GetDictionary(object), TypeExtension.GetFieldKey(object, string, out bool), TypeExtension.GetFieldKey<T>(object, string, out bool), TypeExtension.GetFieldKey(object, Type, string, out bool), ObjectExtension.GetIntPtr(object), ObjectExtension.GetIntPtrInt(object), TypeExtension.GetPropertieFind(object, string, bool), TypeExtension.GetProperties(object), TypeExtension.GetPropertyKey(object, string, out bool), TypeExtension.GetPropertyKey<T>(object, string, out bool), TypeExtension.GetPropertyKey(object, Type, string, out bool), TypeExtension.GetValue(object, PropertyDescriptor), TypeExtension.GetValue(object, string, bool), TypeExtension.GetValue(object, string), ObjectExtension.Read<T>(object, object, int, int), ObjectExtension.Read<T>(object, int, object, int, int), DictionaryExtension.SetDictionary(object, IDictionary<string, object>), TypeExtension.SetFieldKey(object, string, object), TypeExtension.SetFieldKey<T>(object, string, object), TypeExtension.SetFieldKey(object, Type, string, object), TypeExtension.SetPropertyKey(object, string, object), TypeExtension.SetPropertyKey<T>(object, string, object), TypeExtension.SetPropertyKey(object, Type, string, object), TypeExtension.SetValue(object, PropertyDescriptor, object), TypeExtension.SetValue(object, string, object, bool), TypeExtension.SetValue(object, string, object), ObjectExtension.ToBase64String(object), ObjectExtension.ToBytes(object), ObjectExtension.ToBytes(object, out Type), DictionaryExtension.ToDictionary(object), DictionaryExtension.ToDictionary<T>(object), DictionaryExtension.ToIDictionary(object), DictionaryExtension.ToIDictionary<T>(object), ObjectExtension.ToJson(object), ObjectExtension.ToJson(object, JsonSerializerOptions), ObjectExtension.ToJsonWeb(object), ObjectExtension.ToJsonWeb(object, Action<JsonSerializerOptions>), ObjectExtension.ToTryVar<T>(object, T), ObjectExtension.ToVar<T>(object), ObjectExtension.ToVar(object, Type, bool), ObjectExtension.ToVar(object, string), ObjectExtension.ToXml(object)

Remarks ​

代码由逆血提供支持

Methods ​

ChangeType(Type, object) ​

根据Type,返回可能存在的值

csharp
public static object ChangeType(Type targetType, object val)

Parameters ​

targetType Type

val object

Returns ​

object

GetClassSimpleName(Type) ​

获取类实例名称

csharp
public static string GetClassSimpleName(Type t)

Parameters ​

t Type

Type

Returns ​

string

GetDefaultValue(Type) ​

获取默认值

csharp
public static string GetDefaultValue(Type destType)

Parameters ​

destType Type

Returns ​

string

GetTypeByRegularName(string) ​

按常规名称获取类型

csharp
public static Type GetTypeByRegularName(string regularName)

Parameters ​

regularName string

Returns ​

Type

GetTypeRegularName(Type) ​

获取类型常规名称

csharp
public static string GetTypeRegularName(Type destType)

Parameters ​

destType Type

Returns ​

string

GetTypeRegularNameOf(object) ​

获取类型的常规名称

csharp
public static string GetTypeRegularNameOf(object obj)

Parameters ​

obj object

Returns ​

string

IsFixLength(Type) ​

是不是数据类型

csharp
public static bool IsFixLength(Type destDataType)

Parameters ​

destDataType Type

Returns ​

bool

IsNumbericType(Type) ​

是数字类型

csharp
public static bool IsNumbericType(Type destDataType)

Parameters ​

destDataType Type

Returns ​

bool

IsSimpleType(Type) ​

是简单类型

csharp
public static bool IsSimpleType(Type t)

Parameters ​

t Type

Returns ​

bool

基于Apache-2.0协议开源