예제 #1
0
        internal static object ParseEnum(Type type, string value)
        {
            int num = Array.IndexOf(Enum.GetNames(type), value);

            if (num < 0)
            {
                throw new ArgumentException(SRErrors.InvalidValue(value));
            }
            return(Enum.GetValues(type).GetValue(num));
        }
예제 #2
0
        private void Init(string value)
        {
            int num = m_names.IndexOf(value);

            if (num < 0)
            {
                throw new ArgumentException(SRErrors.InvalidValue(value));
            }
            m_value = (T)Enum.ToObject(typeof(T), num);
        }