Exemple #1
0
        public static object SpareAddPropConvert(object obj, int id)
        {
            if (id == 1)
            {
                if (obj is int)
                {
                    return((DegreeName)obj);
                }
                else if (obj is string)
                {
                    string     s = (string)obj;
                    DegreeName value;

                    if (DegreeName.TryParse(s, out value))
                    {
                        return(value);
                    }
                }
            }

            // Not a valid value
            return(null);
        }