TypeExtensions class

Contains several useful extension methods for operations with System.Type objects. Most of the functions are self-descriptive.

public static class System.TypeExtensions

Static Methods

Type Name Description
Object GetDefaultValue(this Type type) Gets the default value for a type.
Boolean IsBool(this Type type) Determines whether the specified type is a boolean.
Boolean IsByte(this Type type) Determines whether the specified type is a byte type (either nullable or non-nullable).
Boolean IsChar(this Type type) Determines whether the specified type is a character type (either nullable or non-nullable).
Boolean IsDateTime(this Type type) Determines whether the specified type is a DateTime type (either nullable or non-nullable).
Boolean IsDateTimeOffset(this Type type) Determines whether the specified type is a DateTimeOffset type (either nullable or non-nullable).
Boolean IsDecimal(this Type type) Determines whether the specified type is a decimal (either nullable or non-nullable).
Boolean IsDouble(this Type type) Determines whether the specified type is a double type (either nullable or non-nullable).
Boolean IsFloat(this Type type) Determines whether the specified type is a float (either nullable or non-nullable).
Boolean IsGuid(this Type type) Determines whether the specified type is a GUID type (either nullable or non-nullable).
Boolean IsInt16(this Type type) Determines whether the specified type is a short integer type (either nullable or non-nullable).
Boolean IsInt32(this Type type) Determines whether the specified type is an integer type ((either nullable or non-nullable).
Boolean IsInt64(this Type type) Determines whether the specified type is a big integer type (either nullable or non-nullable).
Boolean IsNullable(this Type type) Determines whether the specified type is nullable.
Boolean IsTimeSpan(this Type type) Determines whether the specified type is a TimeSpan type (either nullable or non-nullable).