Share via


CodeNamespaceImport Sınıf

Tanım

Kullanılacak ad alanını gösteren bir ad alanı içeri aktarma yönergesini temsil eder.

public ref class CodeNamespaceImport : System::CodeDom::CodeObject
public class CodeNamespaceImport : System.CodeDom.CodeObject
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public class CodeNamespaceImport : System.CodeDom.CodeObject
type CodeNamespaceImport = class
    inherit CodeObject
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type CodeNamespaceImport = class
    inherit CodeObject
Public Class CodeNamespaceImport
Inherits CodeObject
Devralma
CodeNamespaceImport
Öznitelikler

Örnekler

Aşağıdaki örnek kod, ad alanını içeri aktarmak CodeNamespaceImport için a CodeNamespaceImport kullanımını gösterir:

// 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.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.
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
'
'            '
'Namespace TestNamespace
'End Namespace

Açıklamalar

CodeNamespaceImport bir ad alanı içeri aktarma yönergesini temsil etmek için kullanılabilir.

Çoğu dilde ad alanı içeri aktarma yönergesi, içeri aktarılan ad alanları içindeki türlerin, içeri aktarılan ad alanları içindeki türlere başvuran koda görünür olmasına neden olur.

Not

Olası belirsizlikten kaçınmak için tam tür başvuruları kullanın.

Oluşturucular

CodeNamespaceImport()

CodeNamespaceImport sınıfının yeni bir örneğini başlatır.

CodeNamespaceImport(String)

İçeri aktaracak belirtilen ad alanını kullanarak sınıfının yeni bir örneğini CodeNamespaceImport başlatır.

Özellikler

LinePragma

Deyimin gerçekleştiği satırı ve dosyayı alır veya ayarlar.

Namespace

İçeri aktaracak ad alanını alır veya ayarlar.

UserData

Geçerli nesne için kullanıcı tarafından tanımlanabilir verileri alır.

(Devralındığı yer: CodeObject)

Yöntemler

Equals(Object)

Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler.

(Devralındığı yer: Object)
GetHashCode()

Varsayılan karma işlevi işlevi görür.

(Devralındığı yer: Object)
GetType()

Type Geçerli örneğini alır.

(Devralındığı yer: Object)
MemberwiseClone()

Geçerli Objectöğesinin sığ bir kopyasını oluşturur.

(Devralındığı yer: Object)
ToString()

Geçerli nesneyi temsil eden dizeyi döndürür.

(Devralındığı yer: Object)

Şunlara uygulanır

Ayrıca bkz.