Class TypeExtensions
Class with extension methods for System.
Inheritance
Namespace: EPiServer.Data.Dynamic
Assembly: EPiServer.Data.dll
Version: 12.0.3Syntax
public static class TypeExtensions : Object
Methods
CreateStore(Type)
Creates an new Dynamic Data Store for the type If a store with the same name already exists then it will be returned, otherwise the store will be created.
Declaration
public static DynamicDataStore CreateStore(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System. |
type | The System. |
Returns
Type | Description |
---|---|
Dynamic |
A Dynamic |
Remarks
See Create
GenerateTypeBag(Type)
Returns a type bag compatible with the Dynamic Data Store CreateStore methods
Declaration
public static Dictionary<string, Type> GenerateTypeBag(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System. |
type | The Type to operate on |
Returns
Type | Description |
---|---|
System. |
A Dictionary<string, Type> |
GetNullableType(Type)
If the type passed is Nullable<T> then the generic parameter at position 0 is returned.
If not then type
is returned
Declaration
public static Type GetNullableType(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System. |
type | The value to check |
Returns
Type | Description |
---|---|
System. |
A System. |
GetOrCreateStore(Type)
Gets the Dynamic Data Store for the type. If a store does not exist for the type then a new one is created.
Declaration
public static DynamicDataStore GetOrCreateStore(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System. |
type | The System. |
Returns
Type | Description |
---|---|
Dynamic |
A Dynamic |
Remarks
See Get
GetStorageType(Type)
Returns the Storagetype
Declaration
public static StorageType GetStorageType(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System. |
type | The Type to operate on |
Returns
Type | Description |
---|---|
Storage |
GetStore(Type)
Gets the Dynamic Data Store for the type. If a store does not exist for the type then null is returned.
Declaration
public static DynamicDataStore GetStore(this Type type)
Parameters
Type | Name | Description |
---|---|---|
System. |
type | The System. |
Returns
Type | Description |
---|---|
Dynamic |
A Dynamic |
Remarks
See Get
HasProperty(Type, String)
Returns whether the Type defines the property with name propertyName
Declaration
public static bool HasProperty(this Type type, string propertyName)
Parameters
Type | Name | Description |
---|---|---|
System. |
type | The Type to operate on |
System. |
propertyName | The name of the property to check for |
Returns
Type | Description |
---|---|
System. |
if the Type defines the property, otherwise
|
IsPropertyOfType(Type, String, Type)
Returns whether the Type defines the property with name propertyName
and if it is of Type propertyType
Declaration
public static bool IsPropertyOfType(this Type type, string propertyName, Type propertyType)
Parameters
Type | Name | Description |
---|---|---|
System. |
type | The Type to operate on |
System. |
propertyName | The name of the property to check for |
System. |
propertyType | The Type the property should be |
Returns
Type | Description |
---|---|
System. |
if the Type defines the property and it is of the Type specified, otherwise
|