Class CustomDataHelper
Represents a class used to handle TriLib CustomData parameter as a Type/Object Dictionary.
Inherited Members
Namespace: TriLibCore.Utils
Assembly: TriLibCore.dll
Syntax
public static class CustomDataHelper
Methods
CreateCustomDataDictionary()
Creates a new Type/Object Dictionary.
Declaration
public static Dictionary<Type, object> CreateCustomDataDictionary()
Returns
Type | Description |
---|---|
Dictionary<Type, object> | The created Dictionary |
CreateCustomDataDictionaryWithData<T>(T)
Creates a new Type/Object Dictionary and adds an existing data to it.
Declaration
public static Dictionary<Type, object> CreateCustomDataDictionaryWithData<T>(T data) where T : class
Parameters
Type | Name | Description |
---|---|---|
T | data | The data to add to the Dictionary. |
Returns
Type | Description |
---|---|
Dictionary<Type, object> | The created Dictionary |
Type Parameters
Name | Description |
---|---|
T |
GetCustomData<T>(object)
Tries to get a value with the type 'T' when the 'customData' is a Type/Object Dictionary.
Declaration
public static T GetCustomData<T>(object customData) where T : class
Parameters
Type | Name | Description |
---|---|---|
object | customData | The customData object. |
Returns
Type | Description |
---|---|
T | The value, if found. Otherwise |
Type Parameters
Name | Description |
---|---|
T | The type of the value to look for. |
SetCustomData<T>(ref object, T)
Tries to set a value with the type 'T' and value 'value' by setting the 'customData' as a Type/Object Dictionary.
Declaration
public static void SetCustomData<T>(ref object customData, T value) where T : class
Parameters
Type | Name | Description |
---|---|---|
object | customData | The customData object. |
T | value | The value to store. |
Type Parameters
Name | Description |
---|---|
T | The type of the value to store. |