Skip to content

TypeExtensions Class ​

Definition ​

Extension methods for the Type class

  • Namespace: JASE.Extensions
  • Assembly: JASE.Primitives.dll

Methods ​

NameDescription
object GetEnumConverterDefault(Type type)Retuns the Enum value containing
string GetEnumJson(Type type, bool preferTextValue = null)Returns a JSON string representing the Label and values for a C# enum Type
long GetEnumMax(Type type)Gets the maximum value defined on an enum datatype
IReadOnlyList<EnumMemberInfo> GetEnumMemberList(Type type)Returns a list containing EnumMemberInfo for each Enum member
bool HasParameterlessCtor(Type type, bool checkNonPublic = null)Returns true if the provided Type has a parameterless constructor
bool IsAnonymousType(Type type)Returns true if the provided Type is anonymously compiled
bool IsDateTimeType(Type type)Returns true if the passed in type is either of type DateTime or DateTime?
bool IsDisposable(Type type)Returns true if the type implement the IDisposable interfaces
bool IsFractionalNumeric(Type type)Returns true if the type appears supports fractional numeric values
bool IsFractionalNumeric(Type type, out Type underlying)Returns true if the type appears supports fractional numeric values
bool IsNullable(Type type)Checks if type is nullable
bool IsNumeric(Type type)Returns true if the type appears to be numeric
bool IsSubclassOfGeneric(Type type, Type generic)Checks if the type is subclassed from a specific generic base class
bool IsTypeOrNullable(Type type, Type isTypeOf)Determines whether the current Type is either the specified type or a nullable version of it.