public static Type GetRealyType(FieldType fieldType) { FieldInfo fieldInfo = fieldType.GetType().GetField(fieldType.ToString()); FieldRealyType realyType = fieldInfo.GetCustomAttribute <FieldRealyType>(); return(realyType?.RealyType); }
public static bool IsStringType(FieldType fieldType) { FieldRealyType realyTypeAttr = typeof(FieldType).GetField(fieldType.ToString()).GetCustomAttribute <FieldRealyType>(); if (realyTypeAttr != null && realyTypeAttr.RealyType == typeof(string)) { return(true); } return(false); }
public static bool IsNumberType(FieldType fieldType) { FieldRealyType realyTypeAttr = typeof(FieldType).GetField(fieldType.ToString()).GetCustomAttribute <FieldRealyType>(); if (realyTypeAttr != null && realyTypeAttr.RealyType.IsValueType && realyTypeAttr.RealyType.IsPrimitive) { return(true); } return(false); }