Has Attribute for MemberInfo - CSharp Reflection

CSharp examples for Reflection:Attribute

Description

Has Attribute for MemberInfo

Demo Code

// Redistribution and use in source and binary forms, with or without modification,
using System.Collections.Generic;
using System.Reflection;
using System;/*from  w  w  w .j ava  2s  . c o  m*/

public class Main{
        internal static bool HasAttribute(MemberInfo member)
        {
            object[] attributes = member.GetCustomAttributes(typeof(CsvIgnore), false);
            return (attributes != null && attributes.Length > 0);
        }
}

Related Tutorials