Type.Namespace プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)


名前空間は、デザイン時の論理的な名前付けに便利な手法で、主に、アプリケーション内のスコープを定義したりクラスや他の型を 1 つの階層構造に編成するために使用されます。ランタイムの観点からすると、名前空間はありません。
現在の Type が構築ジェネリック型を表している場合、このプロパティはジェネリック型定義を含む名前空間を返します。同様に、現在の Type がジェネリック パラメータ T を表している場合、このプロパティは T を定義するジェネリック型定義を含む名前空間を返します。
現在の Type オブジェクトがジェネリック パラメータを表している場合、このプロパティは null 参照 (Visual Basic では Nothing) を返します。

Type の Namespace プロパティと Module プロパティ、および ToString メソッドを使用する例を次に示します。
Imports System Imports Microsoft.VisualBasic Namespace MyNamespace Class [MyClass] End Class '[MyClass] End Namespace 'MyNamespace Public Class Type_ToString_3 Public Shared Sub Main() Try Dim myType As Type = GetType(MyNamespace.MyClass) Console.WriteLine(ControlChars.NewLine + "Printing the details of {0}." + ControlChars.NewLine, myType) ' Get the namespace of the class Type_ToString_3. Console.WriteLine("Namespace: {0}.", myType.Namespace) ' Get the name of the module. Console.WriteLine("Module: {0}.", myType.Module) ' Get the fully qualified common language runtime namespace. Console.WriteLine("Fully qualified type: {0}.", myType.ToString()) Catch e As Exception Console.WriteLine("Exception: " + e.Message.ToString()) End Try End Sub 'Main End Class 'Type_ToString_3
using System; namespace MyNamespace { class MyClass { } } public class Type_ToString_3 { public static void Main() { try { Type myType = typeof(MyNamespace.MyClass); Console.WriteLine("\nPrinting the details of {0}.\n", myType); // Get the namespace of the class Type_ToString_3. Console.WriteLine("Namespace: {0}.", myType.Namespace); // Get the name of the module. Console.WriteLine("Module: {0}.", myType.Module); // Get the fully qualified common language runtime namespace. Console.WriteLine("Fully qualified type: {0}.", myType.ToString()); } catch(Exception e) { Console.WriteLine("Exception: " + e.Message ); } } }
using namespace System; namespace MyNamespace { ref class MyClass{}; } int main() { try { Type^ myType = MyNamespace::MyClass::typeid; Console::WriteLine( "\nPrinting the details of {0}.\n", myType ); // Get the namespace of the class MyClass. Console::WriteLine( "Namespace: {0}.", myType->Namespace ); // Get the name of the module. Console::WriteLine( "Module: {0}.", myType->Module ); // Get the fully qualified common language runtime namespace. Console::WriteLine( "Fully qualified type: {0}.", myType ); } catch ( Exception^ e ) { Console::WriteLine( "Exception: {0}", e->Message ); } }
package MyNamespace; import System.*; class MyClass { } //MyClass public class Type_ToString_3 { public static void main(String[] args) { try { Type myType = MyNamespace.MyClass.class.ToType(); Console.WriteLine("\nPrinting the details of {0}.\n", myType); // Get the namespace of the class Type_ToString_3. Console.WriteLine("Namespace: {0}.", myType.get_Namespace()); // Get the name of the module. Console.WriteLine("Module: {0}.", myType.get_Module()); // Get the fully qualified common language runtime namespace. Console.WriteLine("Fully qualified type: {0}.", myType.ToString()); } catch (System.Exception e) { Console.WriteLine("Exception: " + e.get_Message()); } } //main } //Type_ToString_3

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


_Type.Namespace プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)



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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からType.Namespaceを検索する場合は、下記のリンクをクリックしてください。

- Type.Namespaceのページへのリンク