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