Module.GetType メソッド (String, Boolean)
アセンブリ: mscorlib (mscorlib.dll 内)

<ComVisibleAttribute(True)> _ Public Overridable Function GetType ( _ className As String, _ ignoreCase As Boolean _ ) As Type
Dim instance As Module Dim className As String Dim ignoreCase As Boolean Dim returnValue As Type returnValue = instance.GetType(className, ignoreCase)
/** @attribute ComVisibleAttribute(true) */ public Type GetType ( String className, boolean ignoreCase )
ComVisibleAttribute(true) public function GetType ( className : String, ignoreCase : boolean ) : Type
戻り値
型がこのモジュールに含まれている場合は、指定された型を表す Type オブジェクト。それ以外の場合は null 参照 (Visual Basic では Nothing)。


指定したモジュールの型の名前を表示する例を次に示します。この例では、大文字と小文字を区別するため ignoreCase パラメータに false を指定します。
Imports System Imports System.Reflection 'This code assumes that the root namespace is set to empty(""). 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 myType As Type myType = myModule.GetType("ReflectionModule_Examples.MyMainClass", False) Console.WriteLine("Got type: {0}", myType.ToString()) End Sub 'Main End Class 'MyMainClass 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 myType; myType = myModule.GetType("ReflectionModule_Examples.MyMainClass", false); Console.WriteLine("Got type: {0}", myType.ToString()); } } }
using namespace System; using namespace System::Reflection; namespace ReflectionModule_Examples { public ref class MyMainClass{}; } 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 ]; Type^ myType; myType = myModule->GetType( "ReflectionModule_Examples.MyMainClass", false ); Console::WriteLine( "Got type: {0}", myType ); }
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 myType; myType = myModule.GetType("ReflectionModule_Examples.MyMainClass", false); Console.WriteLine("Got type: {0}", myType.ToString()); } //main } //MyMainClass


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Module.GetType メソッド

名前 | 説明 |
---|---|
Module.GetType () | 現在のインスタンスの Type を取得します。 |
Module.GetType (String) | 大文字小文字を区別する検索を実行して、指定された型を返します。 .NET Compact Framework によってサポートされています。 |
Module.GetType (String, Boolean) | 指定した大文字小文字の区別の扱いに従ってモジュールを検索し、指定した型を返します。 |
Module.GetType (String, Boolean, Boolean) | 大文字小文字を区別したモジュール検索を実行するかどうか、および型が見つからない場合に例外をスローするかどうかを指定して、指定された型を返します。 |

Module.GetType メソッド (String, Boolean, Boolean)
アセンブリ: mscorlib (mscorlib.dll 内)

<ComVisibleAttribute(True)> _ Public Overridable Function GetType ( _ className As String, _ throwOnError As Boolean, _ ignoreCase As Boolean _ ) As Type
Dim instance As Module Dim className As String Dim throwOnError As Boolean Dim ignoreCase As Boolean Dim returnValue As Type returnValue = instance.GetType(className, throwOnError, ignoreCase)
[ComVisibleAttribute(true)] public virtual Type GetType ( string className, bool throwOnError, bool ignoreCase )
[ComVisibleAttribute(true)] public: virtual Type^ GetType ( String^ className, bool throwOnError, bool ignoreCase )
/** @attribute ComVisibleAttribute(true) */ public Type GetType ( String className, boolean throwOnError, boolean ignoreCase )
ComVisibleAttribute(true) public function GetType ( className : String, throwOnError : boolean, ignoreCase : boolean ) : Type
戻り値
型がこのモジュールで宣言されている場合は、指定された型を表す Type オブジェクト。それ以外の場合は null 参照 (Visual Basic では Nothing)。


throwOnError パラメータは、型が見つからなかった場合の動作にのみ影響します。スローされる可能性のあるその他の例外には影響しません。特に、型が見つかっても読み込むことができない場合は、throwOnError が false であっても TypeLoadException がスローされます。

指定したモジュールの型の名前を表示する例を次に示します。throwOnError パラメータと ignoreCase パラメータは false に指定できます。
Imports System Imports System.Reflection 'This code assumes that the root namespace is set to empty(""). 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 this class. Dim myModule As [Module] = moduleArray(0) Dim myType As Type myType = myModule.GetType("ReflectionModule_Examples.MyMainClass", False, False) Console.WriteLine("Got type: {0}", myType.ToString()) End Sub 'Main End Class 'MyMainClass 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 this class. Module myModule = moduleArray[0]; Type myType; myType = myModule.GetType("ReflectionModule_Examples.MyMainClass" , false, false); Console.WriteLine("Got type: {0}", myType.ToString()); } } }
using namespace System; using namespace System::Reflection; namespace ReflectionModule_Examples { public ref class MyMainClass{}; } 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 this class. Module^ myModule = moduleArray[ 0 ]; Type^ myType; myType = myModule->GetType( "ReflectionModule_Examples.MyMainClass", false, false ); Console::WriteLine( "Got type: {0}", myType ); }
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 this class. Module myModule = (Module)moduleArray.get_Item(0); Type myType; myType = myModule.GetType("ReflectionModule_Examples.MyMainClass" , false, false); Console.WriteLine("Got type: {0}", myType.ToString()); } //main } //MyMainClass


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Module.GetType メソッド (String)
アセンブリ: mscorlib (mscorlib.dll 内)

<ComVisibleAttribute(True)> _ Public Overridable Function GetType ( _ className As String _ ) As Type
Dim instance As Module Dim className As String Dim returnValue As Type returnValue = instance.GetType(className)
戻り値
型がこのモジュールに含まれている場合は、指定された型を表す Type オブジェクト。それ以外の場合は null 参照 (Visual Basic では Nothing)。


Imports System Imports System.Reflection 'This code assumes that the root namespace is set to empty(""). 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 myType As Type myType = myModule.GetType("ReflectionModule_Examples.MyMainClass") Console.WriteLine("Got type: {0}", myType.ToString()) End Sub 'Main End Class 'MyMainClass 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 myType; myType = myModule.GetType("ReflectionModule_Examples.MyMainClass"); Console.WriteLine("Got type: {0}", myType.ToString()); } } }
using namespace System; using namespace System::Reflection; namespace ReflectionModule_Examples { public ref class MyMainClass{}; } 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 ]; Type^ myType; myType = myModule->GetType( "ReflectionModule_Examples.MyMainClass" ); Console::WriteLine( "Got type: {0}", myType ); }
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 myType; myType = myModule.GetType("ReflectionModule_Examples.MyMainClass"); Console.WriteLine("Got type: {0}", myType.ToString()); } //main } //MyMainClass


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- Module.GetType メソッドのページへのリンク