Exemple #1
0
        public T OrDefault(string value)
        {
            if (typeof(T).IsEnum)
            {
                T parsed = Easily.Parse <T>(value.ToString());

                DefaultValue = parsed;

                if (Please == null)
                {
                    Please = parsed;
                }
                else if (!Please.Equals(default(T)))
                {
                    Please = parsed;
                }
            }
            else if (typeof(T) == typeof(string))
            {
                DefaultValue = (T)(System.Object)value;

                if (Please == null)
                {
                    Please = DefaultValue;
                }
            }

            return(Please);
        }
Exemple #2
0
 private void SetPlease(string value)
 {
     Please = Please.Equals(default(T)) ? Please : Easily.Parse <T>(value);
 }