public class VolumeProperty : AbstractProperty{ public VolumeProperty(double initialValue) : base(initialValue) { } public override void SetValue(double newValue) { if (newValue < 0.0 || newValue > 1.0) { throw new ArgumentOutOfRangeException("Volume must be between 0 and 1."); } base.SetValue(newValue); } }
public class LanguageProperty : AbstractPropertyThe LanguageProperty class is similar to the VolumeProperty class, but with a generic parameter of string instead of double. The class adds a SetLanguage method to enforce that the new language value cannot be null or empty. Overall, the MediaPortal.Common.General package library provides useful base classes like AbstractProperty to help simplify development for MediaPortal applications.{ public LanguageProperty(string initialValue) : base(initialValue) { } public void SetLanguage(string newLanguage) { if (string.IsNullOrEmpty(newLanguage)) { throw new ArgumentNullException("Language cannot be null or empty."); } base.SetValue(newLanguage); } }