CSharp examples for System:Attribute
Get Attribute From Enum Type
using System.Threading.Tasks; using System.Text; using System.Linq; using System.Collections.Generic; using System;/*from w w w .j ava 2s . c om*/ public class Main{ public static T GetAttributeFromEnumType<T>(this Type type, object value) where T : Attribute { var field = type.GetField(value.ToString()); return (T)Attribute.GetCustomAttribute(field, typeof(T)); } }