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)); }
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); }