OdsoRecipientDataCollection

OdsoRecipientDataCollection class

A typed collection of OdsoRecipientData

To learn more, visit the Mail Merge and Reporting documentation article.

public class OdsoRecipientDataCollection : IEnumerable<OdsoRecipientData>

Constructors

NameDescription
OdsoRecipientDataCollection()The default constructor.

Properties

NameDescription
Count { get; }Gets the number of elements contained in the collection.
Item { get; set; }Gets or sets an item in this collection.

Methods

NameDescription
Add(OdsoRecipientData)Adds an object to the end of this collection.
Clear()Removes all elements from this collection.
GetEnumerator()Returns an enumerator object that can be used to iterate over all items in the collection.
RemoveAt(int)Removes the element at the specified index.

Examples

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())
    {
        Console.WriteLine(
            $"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.
dataCollection.RemoveAt(0);

Assert.AreEqual(69, dataCollection.Count);

dataCollection.Clear();

Assert.AreEqual(0, dataCollection.Count);

See Also