Type.FilterNameIgnoreCase フィールド


名前に適用され、大文字と小文字を区別しないメンバー フィルターを表します。Represents the case-insensitive member filter used on names. このフィールドは読み取り専用です。This field is read-only.

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


次の例ではMemberFilter 、デリゲートを取得し、それをパラメーター FindMembersとしてメソッドに渡し、文字 "c" Stringで始まるクラスのメソッドとその属性を表示します。大文字と小文字は無視されます。The following example gets the MemberFilter delegate, passes it as a parameter to the FindMembers method, and displays the methods and their attributes of the String class that begin with the letter "c", disregarding the case.

using namespace System;
using namespace System::Collections;
using namespace System::Reflection;
using namespace System::Security;
int main()
      MemberFilter^ myFilter = Type::FilterNameIgnoreCase;
      Type^ myType = System::String::typeid;
      array<MemberInfo^>^myMemberinfo1 = myType->FindMembers( static_cast<MemberTypes>(MemberTypes::Constructor | MemberTypes::Method), static_cast<BindingFlags>(BindingFlags::Public | BindingFlags::Static | BindingFlags::Instance), myFilter, "C*" );
      IEnumerator^ myEnum = myMemberinfo1->GetEnumerator();
      while ( myEnum->MoveNext() )
         MemberInfo^ myMemberinfo2 = safe_cast<MemberInfo^>(myEnum->Current);
         Console::Write( "\n {0}", myMemberinfo2->Name );
         MemberTypes Mymembertypes = myMemberinfo2->MemberType;
         Console::WriteLine( " is a {0}", Mymembertypes );
   catch ( ArgumentNullException^ e ) 
      Console::Write( "ArgumentNullException : {0}", e->Message );
   catch ( SecurityException^ e ) 
      Console::Write( "SecurityException : {0}", e->Message );
   catch ( Exception^ e ) 
      Console::Write( "Exception : {0}", e->Message );
using System;
using System.Reflection;
using System.Security;
public class MyFilterNameIgnoreCaseSample
    public static void Main()
            MemberFilter myFilter = Type.FilterNameIgnoreCase;
            Type myType = typeof(System.String);
            MemberInfo[] myMemberinfo1 = myType.FindMembers(MemberTypes.Constructor
                |MemberTypes.Method, BindingFlags.Public | BindingFlags.Static |
                BindingFlags.Instance, myFilter, "C*");
            foreach (MemberInfo myMemberinfo2 in myMemberinfo1) 
                Console.Write("\n" + myMemberinfo2.Name);
                MemberTypes Mymembertypes = myMemberinfo2.MemberType; 
                Console.WriteLine(" is a " + Mymembertypes.ToString()); 
        catch(ArgumentNullException e)
            Console.Write("ArgumentNullException : " + e.Message); 
        catch(SecurityException e)
            Console.Write("SecurityException : " + e.Message); 
        catch(Exception e)
            Console.Write("Exception : " + e.Message); 
Imports System.Reflection
Imports System.Security

Public Class MyFilterNameIgnoreCaseSample
    Public Shared Sub Main()
            Dim myFilter As MemberFilter = Type.FilterNameIgnoreCase
            Dim myType As Type = GetType(System.String)
            Dim myMemberinfo1 As MemberInfo() = myType.FindMembers(MemberTypes.Constructor Or MemberTypes.Method, BindingFlags.Public Or BindingFlags.Static Or BindingFlags.Instance, myFilter, "C*")
            Dim myMemberinfo2 As MemberInfo
            For Each myMemberinfo2 In myMemberinfo1
                Console.Write((ControlChars.NewLine + myMemberinfo2.Name))
                Dim Mymembertypes As MemberTypes = myMemberinfo2.MemberType
                Console.WriteLine((" is a " + Mymembertypes.ToString()))
            Next myMemberinfo2
        Catch e As ArgumentNullException
            Console.Write("ArgumentNullException : " + e.Message.Tostring())
        Catch e As SecurityException
            Console.Write("SecurityException : " + e.Message.Tostring())
        Catch e As Exception
            Console.Write("Exception : " + e.Message.Tostring())
        End Try
    End Sub
End Class


このフィールドはFindMembers 、メソッドによって使用されるデリゲートへの参照を保持します。This field holds a reference to the delegate used by the FindMembers method. このデリゲートによってカプセル化されるメソッドは、2つMemberInfoのパラメーターを受け取ります。 Object1 つ目はオブジェクトで、2番目のパラメーターはです。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デリゲートが呼び出されると、 MemberInfoオブジェクトによって表されるメソッドの名前が "byte" で始まり、大文字と小文字が区別されない場合にのみ、true が返されます。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", ignoring case.