C# Type FilterAttribute

Description

Type FilterAttribute represents the member filter used on attributes. This field is read-only.

Syntax

Type.FilterAttribute has the following syntax.


public static readonly MemberFilter FilterAttribute

Example

The following example gets the FilterAttribute delegate, passes it as a parameter to the FindMembers method, and displays the specified members and their attributes.


using System;/*  w  w  w .  j  a  v  a  2  s.c  om*/
using System.Reflection;
using System.Security;

public class MyFilterAttributeSample
{
    public static void Main()
    {
            MemberFilter myFilter = Type.FilterAttribute;
            Type myType = typeof(System.String);
            MemberInfo[] myMemberInfoArray = myType.FindMembers(MemberTypes.Constructor
                |MemberTypes.Method, BindingFlags.Public | BindingFlags.Static |
                BindingFlags.Instance, myFilter, MethodAttributes.SpecialName);
            foreach (MemberInfo myMemberinfo in myMemberInfoArray) 
            { 
                Console.Write ("\n" + myMemberinfo.Name);
                Console.Write (" is a " + myMemberinfo.MemberType.ToString()); 
            }

    }  
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version