Type.FilterName Type.FilterName Type.FilterName Type.FilterName Field

定义

表示用于名称的区分大小写的成员筛选器。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对象,并且第二个ObjectThe method encapsulated by this delegate takes two parameters: the first is a MemberInfo object and the second is an Object. 该方法确定是否MemberInfo对象与指定的条件相匹配ObjectThe 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可能分配值"字节 *"。For example, the Object may be assigned the value "Byte*". 在这种情况下,当FilterName调用委托时,它将返回true仅当该方法由MemberInfo对象具有以"字节"开头的名称。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".

适用于

另请参阅