Clone

Document.Clone method

Derin bir kopyasını gerçekleştirirDocument .

public Document Clone()

Geri dönüş değeri

Klonlanmış belge.

Örnekler

Bir belgenin nasıl derin klonlanacağını gösterir.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.Write("Hello world!");

// Klonlama, orijinaliyle aynı içeriğe sahip yeni bir belge üretecektir.
// ancak orijinal belgenin her bir düğümünün benzersiz bir kopyasıyla.
Document clone = doc.Clone();

Assert.AreEqual(doc.FirstSection.Body.FirstParagraph.Runs[0].GetText(),
    clone.FirstSection.Body.FirstParagraph.Runs[0].Text);
Assert.AreNotEqual(doc.FirstSection.Body.FirstParagraph.Runs[0].GetHashCode(),
    clone.FirstSection.Body.FirstParagraph.Runs[0].GetHashCode());

Ayrıca bakınız