Module.FilterTypeNameIgnoreCase Alan
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
TypeFilter
Bu modülde tanımlanan türlerin listesini ada göre filtreleyen bir nesne. Bu alan büyük/küçük harfe duyarlı değildir ve salt okunurdur.
public: static initonly System::Reflection::TypeFilter ^ FilterTypeNameIgnoreCase;
public static readonly System.Reflection.TypeFilter FilterTypeNameIgnoreCase;
staticval mutable FilterTypeNameIgnoreCase : System.Reflection.TypeFilter
Public Shared ReadOnly FilterTypeNameIgnoreCase As TypeFilter
Alan Değeri
Örnekler
Aşağıdaki örnekte, büyük/küçük harf yoksayılarak belirtilen arama ölçütleri ile eşleşen modül adları görüntülenir.
using namespace System;
using namespace System::Reflection;
using namespace System::Collections;
public ref class MyMainClass{};
public ref class MySecondClass{};
// This class does not fit the filter criteria 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::FilterTypeNameIgnoreCase, "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 );
}
}
using System;
using System.Reflection;
namespace ReflectionModule_Examples
{
class MyMainClass
{
static void Main()
{
Module[] moduleArray;
moduleArray = typeof(MyMainClass).Assembly.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.FilterTypeNameIgnoreCase, "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
{
}
}
Imports System.Reflection
Namespace ReflectionModule_Examples
Class MyMainClass
Shared Sub Main()
Dim moduleArray() As [Module]
moduleArray = GetType(MyMainClass).Assembly.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].FilterTypeNameIgnoreCase, "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
End Class
Class MySecondClass
End Class
'This class does not fit the filter criteria my*
Class YourClass
End Class
End Namespace 'ReflectionModule_Examples
Açıklamalar
Filtre, sondaki "*" joker karakterlerini destekler.
Şunlara uygulanır
Ayrıca bkz.
Geri Bildirim
https://aka.ms/ContentUserFeedback.
Çok yakında: 2024 boyunca, içerik için geri bildirim mekanizması olarak GitHub Sorunları’nı kullanımdan kaldıracak ve yeni bir geri bildirim sistemiyle değiştireceğiz. Daha fazla bilgi için bkz.Gönderin ve geri bildirimi görüntüleyin