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)
Summary:
Gets the value for the specified key, or, if the value doesn't exist, saves the defaultValue and returns it.
Type parameters
| Name | Description |
|---|---|
T | The type of the value to get or create. |
Parameters
| Name | Type | Description |
|---|---|---|
defaultValue | T | The default value, if no value is saved yet. |
key = null | string? | The key of the setting. Automatically set through the CallerMemberNameAttribute. |
Returns: T? -- The Type.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | A ArgumentNullException. |