Skip to content

SettingsStorage.GetOrCreate(T, string?) method

Defined in

Type: SettingsStorage Namespace: ReactiveMarbles.CacheDatabase.Settings.Core Assembly: ReactiveMarbles.CacheDatabase.EncryptedSettings.dll

Applies to

netstandard2.0, netstandard2.0

protected T? GetOrCreate<T>(T defaultValue, string? key = null)

View source

Summary: Gets the value for the specified key, or, if the value doesn't exist, saves the defaultValue and returns it.

Type parameters

NameDescription
TThe type of the value to get or create.

Parameters

NameTypeDescription
defaultValueTThe default value, if no value is saved yet.
key = nullstring?The key of the setting. Automatically set through the CallerMemberNameAttribute.

Returns: T? -- The Type.

Exceptions

TypeCondition
System.ArgumentNullExceptionA ArgumentNullException.