CodeNamespaceImport クラス
アセンブリ: System (system.dll 内)

<SerializableAttribute> _ <ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _ <ComVisibleAttribute(True)> _ Public Class CodeNamespaceImport Inherits CodeObject
[SerializableAttribute] [ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)] [ComVisibleAttribute(true)] public class CodeNamespaceImport : CodeObject
[SerializableAttribute] [ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)] [ComVisibleAttribute(true)] public ref class CodeNamespaceImport : public CodeObject

CodeNamespaceImport を使用して、名前空間インポート ディレクティブを表すことができます。
多くの言語では、名前空間インポート ディレクティブによって、インポートされる名前空間内の型を参照するコードから、インポートされる名前空間内の型を参照できるようになります。
![]() |
---|

CodeNamespaceImport を使用して CodeNamespaceImport 名前空間をインポートするコード例を次に示します。
' Declares a compile unit to contain a namespace. Dim compileUnit As New CodeCompileUnit() ' Declares a namespace named TestNamespace. Dim testNamespace As New CodeNamespace("TestNamespace") ' Adds the namespace to the namespace collection of the compile unit. compileUnit.Namespaces.Add(testNamespace) ' Declares a namespace import of the System namespace. Dim import1 As New CodeNamespaceImport("System") ' Adds the namespace import to the namespace imports collection of the namespace. testNamespace.Imports.Add(import1) ' A Visual Basic code generator produces the following source code for the preceeding example code: 'Option Strict Off 'Option Explicit On ' 'Imports System ' 'Namespace TestNamespace 'End Namespace
// Declares a compile unit to contain a namespace. CodeCompileUnit compileUnit = new CodeCompileUnit(); // Declares a namespace named TestNamespace. CodeNamespace testNamespace = new CodeNamespace("TestNamespace"); // Adds the namespace to the namespace collection of the compile unit. compileUnit.Namespaces.Add(testNamespace); // Declares a namespace import of the System namespace. CodeNamespaceImport import1 = new CodeNamespaceImport("System"); // Adds the namespace import to the namespace imports collection of the namespace. testNamespace.Imports.Add(import1); // A C# code generator produces the following source code for the preceeding example code: // namespace TestNamespace { // using System; // // }
// Declares a compile unit to contain a namespace. CodeCompileUnit^ compileUnit = gcnew CodeCompileUnit; // Declares a namespace named TestNamespace. CodeNamespace^ testNamespace = gcnew CodeNamespace( "TestNamespace" ); // Adds the namespace to the namespace collection of the compile unit. compileUnit->Namespaces->Add( testNamespace ); // Declares a namespace import of the System namespace. CodeNamespaceImport^ import1 = gcnew CodeNamespaceImport( "System" ); // Adds the namespace import to the namespace imports collection of the namespace. testNamespace->Imports->Add( import1 ); // A C# code generator produces the following source code for the preceeding example code: // namespace TestNamespace { // using System; // // }
// Declares a compile unit to contain a namespace. CodeCompileUnit compileUnit = new CodeCompileUnit(); // Declares a namespace named TestNamespace. CodeNamespace testNamespace = new CodeNamespace("TestNamespace"); // Adds the namespace to the namespace collection of the compile unit. compileUnit.get_Namespaces().Add(testNamespace); // Declares a namespace import of the System namespace. CodeNamespaceImport import1 = new CodeNamespaceImport("System"); // Adds the namespace import to the namespace imports collection // of the namespace. testNamespace.get_Imports().Add(import1); // A VJ# code generator produces the following source code for // the preceeding example code: // package TestNamespace; // import System;

System.CodeDom.CodeObject
System.CodeDom.CodeNamespaceImport


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


CodeNamespaceImport コンストラクタ ()
アセンブリ: System (system.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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


CodeNamespaceImport コンストラクタ (String)
アセンブリ: System (system.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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


CodeNamespaceImport コンストラクタ

名前 | 説明 |
---|---|
CodeNamespaceImport () | CodeNamespaceImport クラスの新しいインスタンスを初期化します。 |
CodeNamespaceImport (String) | インポートする名前空間を指定して、CodeNamespaceImport クラスの新しいインスタンスを初期化します。 |

CodeNamespaceImport プロパティ

名前 | 説明 | |
---|---|---|
![]() | LinePragma | ステートメントのファイルと行を取得または設定します。 |
![]() | Namespace | インポートする名前空間を取得または設定します。 |
![]() | UserData | 現在のオブジェクトのユーザー定義可能なデータを取得または設定します。 ( CodeObject から継承されます。) |

CodeNamespaceImport メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

CodeNamespaceImport メンバ
使用する名前空間を示す名前空間インポート ディレクティブを表します。
CodeNamespaceImport データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | LinePragma | ステートメントのファイルと行を取得または設定します。 |
![]() | Namespace | インポートする名前空間を取得または設定します。 |
![]() | UserData | 現在のオブジェクトのユーザー定義可能なデータを取得または設定します。(CodeObject から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- CodeNamespaceImportのページへのリンク