Ejemplo n.º 1
0
        public SelectOption(TValue value, bool selected = false) : base()
        {
            if (this._isEnumType)
            {
                this.Label = EnumExtensions
                             .GetAttributeOfType <EnumMemberAttribute>(value as Enum)
                             ?.Value
                             ?? Enum.Format(typeof(TValue), value, "F");
            }
            else
            {
                this.Label = value.ToString();
            }

            this.Value    = value;
            this.Selected = selected;
        }