/// <summary> /// Returns the device settings of the specified type. Not that if an instance of the type has not been created. /// It is created and returned. /// </summary> public T GetDeviceSettings <T>() where T : DeviceSettings { var settings = DeviceSettings.OfType <T>().FirstOrDefault(); if (settings == null) { settings = Activator.CreateInstance <T>(); AddDeviceSettings(settings); } return(settings); }
/// <summary> /// Returns true if a device settings class has been created for the specified type. /// </summary> public bool AreDeviceSetingsDefined <T>() where T : DeviceSettings { return(DeviceSettings.OfType <T>().Any()); }