Skip to content

Properties.Set Method

Overloads

Name Description
Set<T>(String, T) Sets the value of a single valued property with the specified key.
Set<T>(String, T, T) Sets the value of a single valued property with the specified key. Uses a field to cache the value for better performance.
Set<T>(String, T, T?) Sets the value of a single valued property with the specified key. Uses a field to cache the value for better performance.

Set<T>(String, T)

Sets the value of a single valued property with the specified key.

public void Set<T>(string key, T value);

View source

Type Parameters

Name Description
T The type of the property.

Parameters

Name Type Description
key String The key of the property.
value T The value of the property.

Set<T>(String, T, T)

Sets the value of a single valued property with the specified key. Uses a field to cache the value for better performance.

public void Set<T>(string key, T value, out T? cached)
   where T : class;

View source

Type Parameters

Name Description
T The type of the property.

Parameters

Name Type Description
key String The key of the property.
value T The value of the property.
cached T The key of the property.

Remarks

Properties are stored in a dictionary which might not have enough performance in some situations. Use this overload to get higher performance as the value will be stored in the field if it exists. Make sure to use GetOrThrow<T>(String, T) to retrieve the cached field.

Set<T>(String, T, T?)

Sets the value of a single valued property with the specified key. Uses a field to cache the value for better performance.

public void Set<T>(string key, T value, out T?? cached)
   where T : struct;

View source

Type Parameters

Name Description
T The type of the property.

Parameters

Name Type Description
key String The key of the property.
value T The value of the property.
cached T? The key of the property.

Remarks

Properties are stored in a dictionary which might not have enough performance in some situations. Use this overload to get higher performance as the value will be stored in the field if it exists. Make sure to use GetOrThrow<T>(String, T) to retrieve the cached field.