CodeNamespaceImport
メンバ
コンストラクタ
- public CodeNamespaceImport();
-
- 概要
- System.CodeDom.CodeNamespaceImport クラスの新しいインスタンスを初期化します。
- public CodeNamespaceImport( string nameSpace );
-
- 概要
- インポートする名前空間を指定して、CodeNamespaceImport クラスの新しいインスタンスを初期化します。
- パラメーター
-
- nameSpace
- インポートする名前空間の名前。
プロパティ
- public CodeLinePragma LinePragma{ get; set; }
-
- 概要
- ステートメントのファイルと行を取得または設定します。
- 戻り値
- A System.CodeDom.CodeLinePragma ステートメントのコンテキストを示します。
- public string Namespace{ get; set; }
-
- 概要
- インポートする名前空間を取得または設定します。
- 戻り値
- インポートする名前空間の名前。
- UserData
- 現在のオブジェクトのユーザー定義可能なデータを取得します。 (Inherited from CodeObject )
メソッド
- Equals(Object)
- 指定したオブジェクトが、現在のオブジェクトと等しいかどうかを判断します。 (Inherited from Object)
- GetHashCode()
- 既定のハッシュ関数として機能します。 (Inherited from Object)
- GetType()
- 現在のインスタンスの Type を取得します。 (Inherited from Object)
- MemberwiseClone()
- 現在の Object の簡易コピーを作成します。 (Inherited from Object)
- ToString()
- 現在のオブジェクトを表す文字列を返します。 (Inherited from Object)
例
次のコード例に示しますを使用するCodeNamespaceImportをインポートする、CodeNamespaceImport名前空間。
// Declares a compile unit to contain a namespace.
// namespaceを含むように、編集ユニットを宣言する。
CodeCompileUnit compileUnit = new CodeCompileUnit();
// Declares a namespace named TestNamespace.
// TestNamespaceと名付けられたnamespaceを宣言する。
CodeNamespace testNamespace = new CodeNamespace( "TestNamespace" );
// Adds the namespace to the namespace collection of the compile unit.
// namespaceを編集ユニットのnamespaceコレクションに追加する。
compileUnit.Namespaces.Add( testNamespace );
// Declares a namespace import of the System namespace.
// システムnamespaceのnamespace輸入を宣言する。
CodeNamespaceImport import1 = new CodeNamespaceImport( "System" );
// Adds the namespace import to the namespace imports collection of the namespace.
// namespace輸入をnamespaceのnamespace輸入コレクションに追加する。
testNamespace.Imports.Add( import1 );
// A C# code generator produces the following source code for the preceeding example code:
// A C#コードジェネレータはpreceeding例コードのための以下のソースコードを作り出す:
// namespace TestNamespace {
// using System;
//
// }
定義
[System.Runtime.InteropServices.ComVisible(true)]
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Serializable]
public class CodeNamespaceImport : System.CodeDom.CodeObject
クラス
#region アセンブリ System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// C:¥Program Files (x86)¥Reference Assemblies¥Microsoft¥Framework¥.NETFramework¥v4.6.1¥System.dll
#endregion
using System.Runtime.InteropServices;
namespace System.CodeDom
{
//
// 概要:
// 使用する名前空間を示す名前空間インポート ディレクティブを表します。
[ClassInterface( ClassInterfaceType.AutoDispatch )]
[ComVisible( true )]
public class CodeNamespaceImport : CodeObject
{
//
// 概要:
// System.CodeDom.CodeNamespaceImport クラスの新しいインスタンスを初期化します。
public CodeNamespaceImport();
//
// 概要:
// 新しいインスタンスを初期化、 System.CodeDom.CodeNamespaceImport クラスの指定した名前空間を使用してインポートします。
//
// パラメーター:
// nameSpace:
// インポートする名前空間の名前。
public CodeNamespaceImport( string nameSpace );
//
// 概要:
// 取得またはステートメントのあるファイルと行を設定します。
//
// 戻り値:
// A System.CodeDom.CodeLinePragma ステートメントのコンテキストを示します。
public CodeLinePragma LinePragma
{
get;
set;
}
//
// 概要:
// 取得またはインポートする名前空間を設定します。
//
// 戻り値:
// インポートする名前空間の名前。
public string Namespace
{
get;
set;
}
}
}