Aspose::Words::Bibliography::PersonCollection::RemoveAt method

PersonCollection::RemoveAt method

Removes the person at the specified index.

void Aspose::Words::Bibliography::PersonCollection::RemoveAt(int32_t index)
ParameterTypeDescription
indexint32_tThe zero-based index of the person to remove.

Examples

Shows how to work with person collection.

// Create a new person collection.
auto persons = System::MakeObject<Aspose::Words::Bibliography::PersonCollection>();
auto person = System::MakeObject<Aspose::Words::Bibliography::Person>(u"Roxanne", u"Brielle", u"Tejeda_updated");
// Add new person to the collection.
persons->Add(person);
ASSERT_EQ(persons->get_Count(), 1);
// Remove person from the collection if it exists.
if (persons->Contains(person))
{
    persons->Remove(person);
}
ASSERT_EQ(persons->get_Count(), 0);

// Create person collection with two persons.
persons = System::MakeObject<Aspose::Words::Bibliography::PersonCollection>(System::MakeArray<System::SharedPtr<Aspose::Words::Bibliography::Person>>({System::MakeObject<Aspose::Words::Bibliography::Person>(u"Roxanne_1", u"Brielle_1", u"Tejeda_1"), System::MakeObject<Aspose::Words::Bibliography::Person>(u"Roxanne_2", u"Brielle_2", u"Tejeda_2")}));
ASSERT_EQ(persons->get_Count(), 2);
// Remove person from the collection by the index.
persons->RemoveAt(0);
ASSERT_EQ(persons->get_Count(), 1);
// Remove all persons from the collection.
persons->Clear();
ASSERT_EQ(persons->get_Count(), 0);

See Also