Type.FilterName 字段

定义

表示用于名称的区分大小写的成员筛选器。Represents the case-sensitive member filter used on names. 此字段为只读。This field is read-only.

public: static initonly System::Reflection::MemberFilter ^ FilterName;
public static readonly System.Reflection.MemberFilter FilterName;
 staticval mutable FilterName : System.Reflection.MemberFilter
Public Shared ReadOnly FilterName As MemberFilter 

字段值

示例

下面的代码示例获取与该用户定义Application类型相关联的方法。The following code example gets the methods associated with the user-defined Application type.

// 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 = 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
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())

注解

此字段包含对FindMembers方法使用的委托的引用。This field holds a reference to the delegate used by the FindMembers method. 此委托封装的方法采用两个参数:第一个是MemberInfo对象,第二个参数Object是。The method encapsulated by this delegate takes two parameters: the first is a MemberInfo object and the second is an Object. 方法确定MemberInfo对象是否与指定Object的条件匹配。The method determines whether the MemberInfo object matches the criteria specified by the Object. Object分配一个字符串值,该字符串值可能包含尾随 "*" 通配符。The Object is assigned a string value, which may include a trailing "*" wildcard character. 仅支持通配符结束字符串匹配。Only wildcard end string matching is supported.

例如, Object可以为分配值 "Byte *"。For example, the Object may be assigned the value "Byte*". 在这种情况下, FilterName当调用委托时,只有当true MemberInfo对象表示的方法具有以 "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".

适用于

另请参阅