Class TypeExtensions
Type extensions.
Inheritance
Namespace: ISynergy.Framework.Core.Extensions
Assembly: ISynergy.Framework.Core.dll
Syntax
public static class TypeExtensions : object
Methods
View SourceGetDefaultValue(Type)
Gets the default value for a type. This method should serve as
a programmatic equivalent to default(T)
.
Declaration
public static object GetDefaultValue(this Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The type whose default value should be retrieved. |
Returns
Type | Description |
---|---|
System.Object |
GetInnerMostType(Type)
Gets the type of the element in a jagged or multi-dimensional matrix.
Declaration
public static Type GetInnerMostType(this Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The array type whose element type should be computed. |
Returns
Type | Description |
---|---|
Type |
GetInterfaces(Type, Boolean)
Get interfaces from type.
Declaration
public static IEnumerable<Type> GetInterfaces(this Type _self, bool includeInherited)
Parameters
Type | Name | Description |
---|---|---|
Type | _self | The self. |
System.Boolean | includeInherited | if set to |
Returns
Type | Description |
---|---|
IEnumerable<Type> | IEnumerable<Type>. |
HasDefaultConstructor(Type)
Determines whether the given type has a public default (parameterless) constructor.
Declaration
public static bool HasDefaultConstructor(this Type t)
Parameters
Type | Name | Description |
---|---|---|
Type | t | The type to check. |
Returns
Type | Description |
---|---|
System.Boolean | True if the type has a public parameterless constructor; false otherwise. |
MakeArrayType(Type, Int32, Boolean)
Returns a type object representing an array of the current type, with the specified number of dimensions.
Declaration
public static Type MakeArrayType(this Type elementType, int rank, bool jagged)
Parameters
Type | Name | Description |
---|---|---|
Type | elementType | Type of the element. |
System.Int32 | rank | The rank. |
System.Boolean | jagged | Whether to return a type for a jagged array of the given rank, or a multdimensional array. Default is false (default is to return multidimensional array types). |
Returns
Type | Description |
---|---|
Type |