コード例 #1
0
        public static int PermitId <EnumType>() where EnumType : struct
        {
            Attribute[]     attributes      = typeof(EnumType).GetTypeInfo().GetCustomAttributes(typeof(PermitAttribute), false) as Attribute[];
            PermitAttribute PermitAttribute = attributes[0] as PermitAttribute;

            return(PermitAttribute.Id);
        }
コード例 #2
0
        public static int PermitId(Type type)
        {
            Attribute[]     attributes      = type.GetTypeInfo().GetCustomAttributes(typeof(PermitAttribute), false) as Attribute[];
            PermitAttribute PermitAttribute = attributes[0] as PermitAttribute;

            return(PermitAttribute.Id);
        }
コード例 #3
0
        public static string PermitGroup <EnumType>() where EnumType : struct
        {
            Attribute[]     attributes      = typeof(EnumType).GetTypeInfo().GetCustomAttributes(typeof(PermitAttribute), false) as Attribute[];
            PermitAttribute PermitAttribute = attributes[0] as PermitAttribute;
            string          name            = PermitAttribute.PermitGroup;

            return(name.IsNullOrEmpty() ? string.Empty : name);
        }