PropertyStoreSetT Method (Object, T, T) |
Set the value for the specified property key, removing the value from the dictionary if it is the default value of T.
Namespace:
Eto
Assembly:
Eto (in Eto.dll) Version: 2.5.3-dev
Syntax public void Set<T>(
Object key,
T value,
T defaultValue = null
)
Public Sub Set(Of T) (
key As Object,
value As T,
Optional defaultValue As T = Nothing
)
member Set :
key : Object *
value : 'T *
?defaultValue : 'T
(* Defaults:
let _defaultValue = defaultArg defaultValue null
*)
-> unit
Parameters
- key
- Type: SystemObject
Key of the property to set. - value
- Type: T
Value for the property. - defaultValue (Optional)
- Type: T
Value of the property when it should be removed from the dictionary. This should match what is passed to GetT(Object, T) when getting the value.
Type Parameters
- T
- The type of the property to set.
Remarks
This can be used as an optimized way to set the value in the dictionary as if the value set equal to the
defaultValue
(e.g. null for reference types, false for bool, 0 for int, etc), then it will be removed from the dictionary
instead of just set to the value, reducing memory usage.
The
GetT(Object, T) should be passed the same default when retrieving the parameter value.
See Also