Aspose::Words::Bibliography::PersonCollection::Remove method
Contents
[
Hide
]PersonCollection::Remove method
Removes the person from the collection.
_Bool Aspose::Words::Bibliography::PersonCollection::Remove(const System::SharedPtr<Aspose::Words::Bibliography::Person> & person)
| Parameter | Type | Description |
|---|---|---|
| person | const System::SharedPtr<Aspose::Words::Bibliography::Person> & | The person to remove from the collection. |
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
- Class PersonCollection
- Namespace Aspose::Words::Bibliography
- Library Aspose.Words for C++