Type.FilterName フィールド
名前に適用され、大文字と小文字を区別するメンバ フィルタを表します。このフィールドは読み取り専用です。
Public Shared ReadOnly FilterName As MemberFilter
[C#]
public static readonly MemberFilter FilterName;
[C++]
public: static MemberFilter* FilterName;
[JScript]
public static var FilterName : MemberFilter;
解説
このフィールドは、 FindMembers メソッドで使用されるデリゲートへの参照を保持します。このデリゲートによってカプセル化されたメソッドは、 MemberInfo オブジェクト、Object という 2 つのパラメータを受け取ります。このメソッドは、 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())
[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);
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
Type クラス | Type メンバ | System 名前空間 | FindMembers | MemberFilter