다음을 통해 공유


Type.FilterNameIgnoreCase Field

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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

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

Syntax

'Declaration
Public Shared ReadOnly FilterNameIgnoreCase As MemberFilter
public static readonly MemberFilter FilterNameIgnoreCase

Remarks

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.

Examples

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.

Imports System.Reflection
Imports System.Security

Public Class Example
    Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)
        Dim myFilter As MemberFilter = Type.FilterNameIgnoreCase
        Dim myType As Type = GetType(System.String)

        Dim myMemberinfo1 As MemberInfo() = _
            myType.FindMembers(MemberTypes.Property Or MemberTypes.Method, _
                BindingFlags.Public Or BindingFlags.Static Or BindingFlags.Instance, _
                myFilter, "c*")

        For Each mi As MemberInfo In myMemberinfo1
            outputBlock.Text &= mi.ToString() & " is a " & _
                mi.MemberType.ToString() & vbLf
        Next 
    End Sub 
End Class 

' This code example produces output similar to the following:
'
'System.String Copy(System.String) is a Method
'System.String Concat(System.Object) is a Method
'System.String Concat(System.Object, System.Object) is a Method
'System.String Concat(System.Object, System.Object, System.Object) is a Method
'System.String Concat(System.Object[]) is a Method
'System.String Concat(System.String) is a Method
'System.String Concat(System.String, System.String) is a Method
'System.String Concat(System.String, System.String, System.String) is a Method
'System.String Concat(System.String[]) is a Method
'Void CopyTo(Int32, Char[], Int32, Int32) is a Method
'Int32 Compare(System.String, System.String) is a Method
'Int32 Compare(System.String, System.String, System.StringComparison) is a Method
'Int32 Compare(System.String, System.String, System.Globalization.CultureInfo, System.Globalization.CompareOptions) is a Method
'Int32 Compare(System.String, Int32, System.String, Int32, Int32) is a Method
'Int32 Compare(System.String, Int32, System.String, Int32, Int32, System.Globalization.CultureInfo, System.Globalization.CompareOption) is a Method
'Int32 Compare(System.String, Int32, System.String, Int32, Int32, System.StringComparison) is a Method
'Int32 CompareTo(System.Object) is a Method
'Int32 CompareTo(System.String) is a Method
'Int32 CompareOrdinal(System.String, System.String) is a Method
'Int32 CompareOrdinal(System.String, Int32, System.String, Int32, Int32) is a Method
'Boolean Contains(System.String) is a Method
'Char Chars[Int32] is a Property
using System;
using System.Reflection;
using System.Security;
public class Example
{
    public static void Demo(System.Windows.Controls.TextBlock outputBlock)
    {
        MemberFilter myFilter = Type.FilterNameIgnoreCase;
        Type myType = typeof(System.String);

        MemberInfo[] myMemberinfo1 = myType.FindMembers(MemberTypes.Property
            | MemberTypes.Method, BindingFlags.Public | BindingFlags.Static |
            BindingFlags.Instance, 
            myFilter, "c*");

        foreach (MemberInfo mi in myMemberinfo1)
        {
            outputBlock.Text += mi.ToString() + " is a " + 
                mi.MemberType.ToString() + "\n";
        }
    }
}

/* This code example produces output similar to the following:

System.String Copy(System.String) is a Method
System.String Concat(System.Object) is a Method
System.String Concat(System.Object, System.Object) is a Method
System.String Concat(System.Object, System.Object, System.Object) is a Method
System.String Concat(System.Object[]) is a Method
System.String Concat(System.String) is a Method
System.String Concat(System.String, System.String) is a Method
System.String Concat(System.String, System.String, System.String) is a Method
System.String Concat(System.String[]) is a Method
Void CopyTo(Int32, Char[], Int32, Int32) is a Method
Int32 Compare(System.String, System.String) is a Method
Int32 Compare(System.String, System.String, System.StringComparison) is a Method
Int32 Compare(System.String, System.String, System.Globalization.CultureInfo, System.Globalization.CompareOptions) is a Method
Int32 Compare(System.String, Int32, System.String, Int32, Int32) is a Method
Int32 Compare(System.String, Int32, System.String, Int32, Int32, System.Globalization.CultureInfo, System.Globalization.CompareOption) is a Method
Int32 Compare(System.String, Int32, System.String, Int32, Int32, System.StringComparison) is a Method
Int32 CompareTo(System.Object) is a Method
Int32 CompareTo(System.String) is a Method
Int32 CompareOrdinal(System.String, System.String) is a Method
Int32 CompareOrdinal(System.String, Int32, System.String, Int32, Int32) is a Method
Boolean Contains(System.String) is a Method
Char Chars[Int32] is a Property
 */

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.