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 

Field Value



下列程式碼範例會取得與使用者定義 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 |
    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): " & _


這個欄位會保存 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 物件是否符合 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 委派時,只有在 MemberInfo 物件所表示的方法具有開頭為 "Byte" 的名稱時,才會傳回 trueIn 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".

Applies to

See also