/// <summary> /// 指定されたUserTypeId列挙型からUserTypeTypeInfoAttributeを取得します。 /// </summary> /// <param name="dbTypeId">UserTypeId列挙型</param> /// <returns>UserTypeTypeInfoAttribute</returns> public static DBTypeInfoAttribute GetAttributes(EnumDBTypeId dbTypeId) { // フィールドの属性取得 FieldInfo fInfo = typeof(EnumDBTypeId).GetField(dbTypeId.ToString()); object[] attributes = fInfo.GetCustomAttributes(typeof(DBTypeInfoAttribute), false); // 属性が無ければエラー if (1 != attributes.Length) { throw new ArgumentException("DBTypeInfo属性が定義されていません。", "userTypeId"); } return (DBTypeInfoAttribute)attributes.Single(); }