Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
FilterNameIgnoreCase Field

Type::FilterNameIgnoreCase Field

Represents the case-insensitive member filter used on names. This field is read-only.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

public:
static initonly MemberFilter^ FilterNameIgnoreCase

This field holds a reference to the delegate used by the FindMembers method. The method encapsulated by this delegate takes two parameters: the first is a MemberInfo object and the second is an Object. The method determines whether the MemberInfo object matches the criteria specified by the Object. The Object is assigned a string value, which may include a trailing "*" wildcard character. Only wildcard end string matching is supported.

For example, the Object may be assigned the value "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", ignoring case.

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()
{
   try
   {
      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 );
   }
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8
Show:
© 2015 Microsoft