Export (0) Print
Expand All

Type.FilterNameIgnoreCase Field

Represents the case-insensitive member filter used on names. This field is read-only.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

public static readonly MemberFilter FilterNameIgnoreCase
public static final MemberFilter FilterNameIgnoreCase
public static final var FilterNameIgnoreCase : MemberFilter

This field holds a reference to the delegate used by the FindMembers method. The method encapsulated by this delegate takes two parameters: the first is a MemberInfo object and the second is an Object. The method determines whether the MemberInfo object matches the criteria specified by the Object. The Object is assigned a string value, which may include a trailing "*" wildcard character. Only wildcard end string matching is supported.

For example, the Object may be assigned the value "ByTe*". In that case, when the FilterName delegate is invoked, it will return true only if the method represented by the MemberInfo object has a name that begins with "byte", ignoring case.

The following example gets the MemberFilter delegate, passes it as a parameter to the FindMembers method, and displays the methods and their attributes of the String class that begin with the letter "c", disregarding the case.

using System;
using System.Reflection;
using System.Security;
public class MyFilterNameIgnoreCaseSample
{
    public static void Main()
    {
        try
        {		
            MemberFilter myFilter = Type.FilterNameIgnoreCase;
            Type myType = typeof(System.String);
            MemberInfo[] myMemberinfo1 = myType.FindMembers(MemberTypes.Constructor
                |MemberTypes.Method, BindingFlags.Public | BindingFlags.Static |
                BindingFlags.Instance, myFilter, "C*");
            foreach (MemberInfo myMemberinfo2 in myMemberinfo1) 
            { 
                Console.Write("\n" + myMemberinfo2.Name);
                MemberTypes Mymembertypes = myMemberinfo2.MemberType; 
                Console.WriteLine(" is a " + Mymembertypes.ToString()); 
            }
        }
        catch(ArgumentNullException e)
        {
            Console.Write("ArgumentNullException : " + e.Message); 
        }   
        catch(SecurityException e)
        {
            Console.Write("SecurityException : " + e.Message); 
        }   
        catch(Exception e)
        {
            Console.Write("Exception : " + e.Message); 
        }
    }
}

import System.*;
import System.Reflection.*;
import System.Security.*;

public class MyFilterNameIgnoreCaseSample
{
    public static void main(String[] args)
    {
        try {
            MemberFilter myFilter = Type.FilterNameIgnoreCase;
            Type myType = System.String.class.ToType();
            MemberInfo myMemberInfo1[] =
                myType.FindMembers(MemberTypes.Constructor | MemberTypes.Method,
                BindingFlags.Public | BindingFlags.Static
                | BindingFlags.Instance, myFilter, "C*");
            for (int iCtr = 0; iCtr < myMemberInfo1.length; iCtr++) {
                MemberInfo myMemberInfo2 = myMemberInfo1[iCtr];
                Console.Write("\n" + myMemberInfo2.get_Name());
                MemberTypes myMemberTypes = myMemberInfo2.get_MemberType();
                Console.WriteLine(" is a " + myMemberTypes.ToString());
            }
        }
        catch (ArgumentNullException e) {
            Console.Write("ArgumentNullException : " + e.get_Message());
        }
        catch (SecurityException e) {
            Console.Write("SecurityException : " + e.get_Message());
        }
        catch (System.Exception e) {
            Console.Write("Exception : " + e.get_Message());
        }
    } //main
} //MyFilterNameIgnoreCaseSample

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft