Type.FilterName 字段

表示用于名称的区分大小写的成员筛选器。此字段为只读。

**命名空间:**System
**程序集:**mscorlib(在 mscorlib.dll 中)

语法

声明
Public Shared ReadOnly FilterName As MemberFilter
用法
Dim value As MemberFilter

value = Type.FilterName
public static readonly MemberFilter FilterName
public:
static initonly MemberFilter^ FilterName
public static final MemberFilter FilterName
public static final var FilterName : MemberFilter

备注

此字段含有对 FindMembers 方法使用的委托的引用。此委托封装的方法使用两个参数:第一个是 MemberInfo 对象,第二个是 Object。此方法确定 MemberInfo 对象是否与 Object 指定的判据相匹配。给 Object 分配了一个字符串值,此字符串值可能包含一个尾部通配符字符“*”。仅支持通配符结尾字符串匹配。

例如,可能分配给 Object 值“Byte*”。在这种情况下,当调用 FilterName 委托时,只有当 MemberInfo 对象表示的方法具有以“Byte”开始的名称,它才返回 true

示例

下面的代码示例获取与用户定义的 Application 类型关联的方法。

' 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())
// 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);
// Get the set of methods associated with the type
array<MemberInfo^>^ mi = Application::typeid->FindMembers(
   (MemberTypes)(MemberTypes::Constructor | MemberTypes::Method),
   (BindingFlags)(BindingFlags::Public | BindingFlags::Static |
      BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::DeclaredOnly),
   Type::FilterName, "*" );
Console::WriteLine( "Number of methods (includes constructors): {0}", mi->Length );
// Get the set of methods associated with the type
MemberInfo mi[] = Application.class.ToType().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));
// 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);

平台

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

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

Type 类
Type 成员
System 命名空间
FindMembers
MemberFilter