Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
FilterName Field

Type.FilterName Field

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

[Visual Basic]
Public Shared ReadOnly FilterName As MemberFilter
[C#]
public static readonly MemberFilter FilterName;
[C++]
public: static MemberFilter* FilterName;
[JScript]
public static var FilterName : MemberFilter;

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".

Example

The following code example gets the methods associated with the user-defined Application type.

[Visual Basic] 
' Get the set of methods associated with the type
Dim mi As MemberInfo() = _
   GetType(Application).FindMembers( _
   MemberTypes.Constructor Or MemberTypes.Method, _
   BindingFlags.DeclaredOnly, _
   Type.FilterName, "*")
Console.WriteLine("Number of methods (includes constructors): " & _
   mi.Length.ToString())

[C#] 
// Get the set of methods associated with the type
MemberInfo[] mi = typeof(Application).FindMembers(MemberTypes.Constructor | 
    MemberTypes.Method, 
    BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
    BindingFlags.Instance | BindingFlags.DeclaredOnly,
    Type.FilterName, "*");
  Console.WriteLine("Number of methods (includes constructors): " + mi.Length);

[C++] 
// Get the set of methods associated with the type
MemberInfo* mi[] = __typeof(Application)->FindMembers(
    static_cast<MemberTypes>(MemberTypes::Constructor | MemberTypes::Method),
    static_cast<BindingFlags>(BindingFlags::Public | BindingFlags::Static | BindingFlags::NonPublic |
        BindingFlags::Instance | BindingFlags::DeclaredOnly),
    Type::FilterName,
    S"*");
Console::WriteLine(S"Number of methods (includes constructors): {0}", __box(mi->Length));

[JScript] 
// Get the set of methods associated with the type
var mi : MemberInfo[] = Application.FindMembers(MemberTypes.Constructor | 
    MemberTypes.Method, 
    BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic |
    BindingFlags.Instance | BindingFlags.DeclaredOnly,
    Type.FilterName, "*");
  Console.WriteLine("Number of methods (includes constructors): " + mi.Length);

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Type Class | Type Members | System Namespace | FindMembers | MemberFilter

Show:
© 2015 Microsoft