Freigeben über


Module.FilterTypeName-Feld

Ein TypeFilter-Objekt, das die in diesem Modul definierte Typenliste nach dem Namen filtert. Bei diesem Feld wird die Groß- und Kleinschreibung berücksichtigt, und es ist schreibgeschützt.

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

Syntax

'Declaration
Public Shared ReadOnly FilterTypeName As TypeFilter
'Usage
Dim value As TypeFilter

value = Module.FilterTypeName
public static readonly TypeFilter FilterTypeName
public:
static initonly TypeFilter^ FilterTypeName
public static final TypeFilter FilterTypeName
public static final var FilterTypeName : TypeFilter

Hinweise

Der Filter unterstützt einen abschließenden Platzhalter "*".

Beispiel

Im folgenden Beispiel werden die Modulnamen angezeigt, die mit den angegebenen Suchkriterien übereinstimmen.

Imports System
Imports System.Reflection

Namespace ReflectionModule_Examples
    Class MyMainClass
        Shared Sub Main()
            Dim moduleArray() As [Module]

            moduleArray = [Assembly].GetExecutingAssembly().GetModules(False)

            ' In a simple project with only one module, the module at index
            ' 0 will be the module containing these classes.
            Dim myModule As [Module] = moduleArray(0)

            Dim tArray() As Type

            tArray = myModule.FindTypes([Module].FilterTypeName, "My*")

            Dim t As Type
            For Each t In tArray
                Console.WriteLine("Found a module beginning with My*: {0}", t.Name)
            Next t
        End Sub 'Main
    End Class 'MyMainClass

    Class MySecondClass
    End Class 'MySecondClass

    ' This class does not fit the filter criteria My*.
    Class YourClass
    End Class 'YourClass
End Namespace 'ReflectionModule_Examples
using System;
using System.Reflection;

namespace ReflectionModule_Examples
{
    class MyMainClass
    {
        static void Main()
        {
            Module[] moduleArray;
            
            moduleArray = Assembly.GetExecutingAssembly().GetModules(false);
            
            // In a simple project with only one module, the module at index
            // 0 will be the module containing these classes.
            Module myModule = moduleArray[0];

            Type[] tArray;

            tArray = myModule.FindTypes(Module.FilterTypeName, "My*");
            
            foreach(Type t in tArray)
            {
                Console.WriteLine("Found a module beginning with My*: {0}.", t.Name);
            }
        }
    }

    class MySecondClass
    {
    }

    // This class does not fit the filter criteria My*.
    class YourClass
    {
    }
}
using namespace System;
using namespace System::Reflection;
using namespace System::Collections;
public ref class MySecondClass{};


// This class does not fit the filter criterion My*.
public ref class YourClass{};

int main()
{
   array<Module^>^moduleArray;
   moduleArray = Assembly::GetExecutingAssembly()->GetModules( false );
   
   // In a simple project with only one module, the module at index
   // 0 will be the module containing these classes.
   Module^ myModule = moduleArray[ 0 ];
   array<Type^>^tArray;
   tArray = myModule->FindTypes( Module::FilterTypeName, "My*" );
   IEnumerator^ myEnum = tArray->GetEnumerator();
   while ( myEnum->MoveNext() )
   {
      Type^ t = safe_cast<Type^>(myEnum->Current);
      Console::WriteLine( "Found a module beginning with My*: {0}.", t->Name );
   }
}
package ReflectionModule_Examples;
 
import System.*;
import System.Reflection.*;

class MyMainClass
{

    public static void main(String[] args)
    {
        Module moduleArray[];
        moduleArray = Assembly.GetExecutingAssembly().GetModules(false);

        // In a simple project with only one module, the module at index
        // 0 will be the module containing these classes.
        Module myModule = (Module)moduleArray.get_Item(0);
        Type tArray[];
        tArray = myModule.FindTypes(Module.FilterTypeName, "My*");
        for (int iCtr = 0; iCtr < tArray.length; iCtr++) {
            Type t = tArray[iCtr];
            Console.WriteLine("Found a module beginning with My*: {0}.",
                t.get_Name());
        }
    } //main
} //MyMainClass

class MySecondClass
{
} //MySecondClass

// This class does not fit the filter criteria My*.
class YourClass
{
} //YourClass

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

Module-Klasse
Module-Member
System.Reflection-Namespace
FindTypes