Ejemplo n.º 1
0
        /// <summary>
        /// Initialize an instance of <see cref="EnumExpression{TEnum}" />.
        /// </summary>
        /// <param name="isNullable">Indicates whether the type is nullable.</param>
        public EnumExpression(bool isNullable)
        {
            Argument.IsValid("TEnum", typeof(TEnum), typeof(TEnum).IsEnumEx());

            IsNullable = isNullable;

            SelectedCondition = Condition.EqualTo;
            EnumValues        = Enum.GetValues(typeof(TEnum)).Cast <TEnum>().ToList();

            Value            = EnumValues.FirstOrDefault();
            ValueControlType = ValueControlType.Enum;
        }
Ejemplo n.º 2
0
 public static DateElement Parse(string str)
 {
     return(EnumValues.FirstOrDefault(t => t.Values.Contains(str, StringComparer.CurrentCulture)) ?? Unknown);
 }