MVC Get Attributes
Yazar:
Yakup KALEBAŞI
·
07 Eylül 2016
Assembly assembly = Assembly.GetExecutingAssembly();
IEnumerable<Type> types = assembly.GetTypes()
.Where(
type =>
typeof(Controller).IsAssignableFrom(type) &&
type.Name.Replace("Controller", "") == controllerName)
.OrderBy(x => x.Name);
foreach (Type cls in types)
{
HelpAttribute helpAttribute = Attribute.GetCustomAttribute(cls, typeof(HelpAttribute)) as HelpAttribute;
url = helpAttribute != null ? helpAttribute.Url : string.Empty;
........
}
Etiketler: C#MVCReflection
Bunlar da hoşunuza gidebilir...