/// <summary> /// Will create a new ListPreference preference if is does not exist, otherwise it will return the cached. /// </summary> /// <param name="name">The name of the preference</param> /// <param name="values">The default values of the preference</param> /// <typeparam name="T">The type of the preference value</typeparam> /// <returns>The preference, never null</returns> public ListPreference <T> ListPreference <T>(string name, IList <T> values = default) { if (HasPreferenceListCache <T>(name, out var result)) { return(result); } result = new ListPreference <T>(provider, name, values); derivations[name] = result; return(result); }
private bool HasPreferenceListCache <T>(string name, out ListPreference <T> preference) { preference = derivations[name] as ListPreference <T>; return(preference != null); }