OdsoRecipientDataCollection.GetEnumerator method

Returns an enumerator object that can be used to iterate over all items in the collection.

public IEnumerator<OdsoRecipientData> GetEnumerator()


Shows how to access the collection of data that designates which merge data source records a mail merge will exclude.

Document doc = new Document(MyDir + "Odso data.docx");

OdsoRecipientDataCollection dataCollection = doc.MailMergeSettings.Odso.RecipientDatas;

Assert.AreEqual(70, dataCollection.Count);

using (IEnumerator<OdsoRecipientData> enumerator = dataCollection.GetEnumerator())
    int index = 0;
    while (enumerator.MoveNext())
            $"Odso recipient data index {index++} will {(enumerator.Current.Active ? "" : "not ")}be imported upon mail merge.");
        Console.WriteLine($"\tColumn #{enumerator.Current.Column}");
        Console.WriteLine($"\tHash code: {enumerator.Current.Hash}");
        Console.WriteLine($"\tContents array length: {enumerator.Current.UniqueTag.Length}");

// We can clone the elements in this collection.
Assert.AreNotEqual(dataCollection[0], dataCollection[0].Clone());

// We can also remove elements individually, or clear the entire collection at once.

Assert.AreEqual(69, dataCollection.Count);


Assert.AreEqual(0, dataCollection.Count);

See Also