CSharp examples for System.Reflection:Type
Has Attribute from a Type
using System.Reflection; using System.Linq; using System.Collections.Generic; using System;//from ww w .ja v a 2s . c om public class Main{ public static bool HasAttribute<TAttribute>(this Type type) { return type.GetCustomAttributes(typeof(TAttribute), true).Any(); } }