-
Notifications
You must be signed in to change notification settings - Fork 0
AppSettings
Artem Kirgizov edited this page May 31, 2021
·
3 revisions
Namespace: Toolkit
AppSettings - singleton for storing application settings. The main purpose is to store settings and receive data by key.
The main features of the class:
string name = "Dev";
AppSettings.Setting["name"] = name;
// AppSettings.Setting["name"] will return "Dev"
if (name == (string)AppSettings.Setting["name"])
{
// Will be true
}
// Contain "Dev" setting by "name" key
var actualSettings = AppSettings.Setting.AvailableSettings();
// "Dev" by key "name" was removed
AppSettings.Setting.RemoveSetting(name);
// Thrown KeyNotFoundException because "name" was removed early
if (name == (string)AppSettings.Setting["name"]) {}
// But this will return null
string setting = AppSettings.Setting.TryGetSetting("name");