Provides the base class for a generic read-only collection.
After demonstrating the xtd::collections::object_model::read_only_collection::count, xtd::collections::object_model::read_only_collection::contains, xtd::collections::object_model::read_only_collection:: opertor [], and xtd::collections::generic::ilist::index_of members, the code example shows that the xtd::collections::object_model::read_only_collection <type_t> is just a wrapper for the original xtd::collections::generic::list <type_t> by adding a new item to the xtd::collections::generic::list <type_t> and displaying the contents of the xtd::collections::object_model::read_only_collection <type_t>.
Finally, the code example creates an array larger than the collection and uses the xtd::collections::object_model::read_only_collection::copy_to method to insert the elements of the collection into the middle of the array.
Public Aliases | |
| using | value_type |
| Represents the list value type. | |
| using | base_type |
| Represents the list base type. | |
| using | size_type |
| Represents the list size type (usually xtd::size). | |
| using | difference_type |
| Represents the list difference type (usually xtd::ptrdiff). | |
| using | reference |
| Represents the reference of list value type. | |
| using | const_reference |
| Represents the const reference of list value type. | |
| using | pointer |
| Represents the pointer of list value type. | |
| using | const_pointer |
| Represents the const pointer of list value type. | |
| using | iterator |
| Represents the iterator of list value type. | |
| using | const_iterator |
| Represents the const iterator of list value type. | |
Public Constructors | |
| read_only_collection (const generic::ilist< value_type > &list) | |
| Initializes a new instance of the xtd::collections::object_model::read_only_collection <type_t> class that is a read-only wrapper around the specified list. | |
Public Properties | |
| auto | count () const noexcept -> xtd::size override |
| Gets the number of elements contained in the xtd::collections::object_model::read_only_collection <type_t> instance. | |
| const xtd::object & | sync_root () const noexcept override |
| static auto | empty_collection () -> const read_only_collection< value_type > & |
| Gets an empty xtd::collections::object_model::read_only_collection <type_t>. | |
Public Methods | |
| auto | contains (const type_t &item) const noexcept -> bool override |
| Determines whether an element is in the xtd::collections::object_model::read_only_collection <type_t>. | |
| auto | copy_to (xtd::array< type_t > &array, xtd::size array_index) const -> void override |
| Copies the entire xtd::collections::object_model::read_only_collection <type_t> to a compatible one-dimensional Array, starting at the specified index of the target array. | |
| generic::enumerator< value_type > | get_enumerator () const noexcept override |
| Returns an enumerator that iterates through the xtd::collections::object_model::read_only_collection <type_t>. | |
| auto | index_of (const type_t &item) const noexcept -> xtd::size override |
| Searches for the specified object and returns the zero-based index of the first occurrence within the entire xtd::collections::object_model::read_only_collection <type_t>. | |
Public Operators | |
| auto | operator[] (size_type index) const -> const_reference override |
| Returns a reference to the element at specified location pos. | |
| auto | operator[] (size_type index) -> reference override |
| Returns a reference to the element at specified location pos. | |
Protected Properties | |
| auto | items () noexcept -> base_type |
| Returns the xtd::collections::generic::ilist <type_t> that the xtd::collections::object_model::read_only_collection <type_t> wraps. | |
Additional Inherited Members | |
| object ()=default | |
| Create a new instance of the ultimate base class object. | |
| virtual bool | equals (const object &obj) const noexcept |
| Determines whether the specified object is equal to the current object. | |
| virtual xtd::size | get_hash_code () const noexcept |
| Serves as a hash function for a particular type. | |
| virtual type_object | get_type () const noexcept |
| Gets the type of the current instance. | |
| template<class object_t> | |
| xtd::unique_ptr_object< object_t > | memberwise_clone () const |
| Creates a shallow copy of the current object. | |
| virtual xtd::string | to_string () const |
| Returns a xtd::string that represents the current object. | |
| template<class object_a_t, class object_b_t> | |
| static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are considered equal. | |
| template<class object_a_t, class object_b_t> | |
| static bool | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are the same instance. | |
| using xtd::collections::object_model::read_only_collection< type_t >::value_type |
Represents the list value type.
| using xtd::collections::object_model::read_only_collection< type_t >::base_type |
Represents the list base type.
| using xtd::collections::object_model::read_only_collection< type_t >::size_type |
Represents the list size type (usually xtd::size).
| using xtd::collections::object_model::read_only_collection< type_t >::difference_type |
Represents the list difference type (usually xtd::ptrdiff).
| using xtd::collections::object_model::read_only_collection< type_t >::reference |
Represents the reference of list value type.
| using xtd::collections::object_model::read_only_collection< type_t >::const_reference |
Represents the const reference of list value type.
| using xtd::collections::object_model::read_only_collection< type_t >::pointer |
Represents the pointer of list value type.
| using xtd::collections::object_model::read_only_collection< type_t >::const_pointer |
Represents the const pointer of list value type.
| using xtd::collections::object_model::read_only_collection< type_t >::iterator |
Represents the iterator of list value type.
| using xtd::collections::object_model::read_only_collection< type_t >::const_iterator |
Represents the const iterator of list value type.
|
inlineexplicit |
Initializes a new instance of the xtd::collections::object_model::read_only_collection <type_t> class that is a read-only wrapper around the specified list.
After demonstrating the xtd::collections::object_model::read_only_collection::count, xtd::collections::object_model::read_only_collection::contains, xtd::collections::object_model::read_only_collection:: opertor [], and xtd::collections::generic::ilist::index_of members, the code example shows that the xtd::collections::object_model::read_only_collection <type_t> is just a wrapper for the original xtd::collections::generic::list <type_t> by adding a new item to the xtd::collections::generic::list <type_t> and displaying the contents of the xtd::collections::object_model::read_only_collection <type_t>.
Finally, the code example creates an array larger than the collection and uses the xtd::collections::object_model::read_only_collection::copy_to method to insert the elements of the collection into the middle of the array.
|
inlinenodiscardoverridenoexcept |
Gets the number of elements contained in the xtd::collections::object_model::read_only_collection <type_t> instance.
After demonstrating the xtd::collections::object_model::read_only_collection::count, xtd::collections::object_model::read_only_collection::contains, xtd::collections::object_model::read_only_collection:: opertor [], and xtd::collections::generic::ilist::index_of members, the code example shows that the xtd::collections::object_model::read_only_collection <type_t> is just a wrapper for the original xtd::collections::generic::list <type_t> by adding a new item to the xtd::collections::generic::list <type_t> and displaying the contents of the xtd::collections::object_model::read_only_collection <type_t>.
Finally, the code example creates an array larger than the collection and uses the xtd::collections::object_model::read_only_collection::copy_to method to insert the elements of the collection into the middle of the array.
|
inlinestaticnodiscard |
Gets an empty xtd::collections::object_model::read_only_collection <type_t>.
|
inlinenodiscardoverridenoexcept |
Determines whether an element is in the xtd::collections::object_model::read_only_collection <type_t>.
| item | The object to locate in the xtd::collections::object_model::read_only_collection <type_t>. The value can be null for reference types. |
After demonstrating the xtd::collections::object_model::read_only_collection::count, xtd::collections::object_model::read_only_collection::contains, xtd::collections::object_model::read_only_collection:: opertor [], and xtd::collections::generic::ilist::index_of members, the code example shows that the xtd::collections::object_model::read_only_collection <type_t> is just a wrapper for the original xtd::collections::generic::list <type_t> by adding a new item to the xtd::collections::generic::list <type_t> and displaying the contents of the xtd::collections::object_model::read_only_collection <type_t>.
Finally, the code example creates an array larger than the collection and uses the xtd::collections::object_model::read_only_collection::copy_to method to insert the elements of the collection into the middle of the array.
|
inlineoverride |
Copies the entire xtd::collections::object_model::read_only_collection <type_t> to a compatible one-dimensional Array, starting at the specified index of the target array.
| array | The one-dimensional xtd::array that is the destination of the elements copied from xtd::collections::object_model::read_only_collection <type_t>. The xtd::array must have zero-based indexing. |
| array_index | The zero-based index in array at which copying begins. |
| xtd::argument_exception | The number of elements in the source xtd::collections::object_model::read_only_collection <type_t> is greater than the available space from index to the end of the destination array. |
After demonstrating the xtd::collections::object_model::read_only_collection::count, xtd::collections::object_model::read_only_collection::contains, xtd::collections::object_model::read_only_collection:: opertor [], and xtd::collections::generic::ilist::index_of members, the code example shows that the xtd::collections::object_model::read_only_collection <type_t> is just a wrapper for the original xtd::collections::generic::list <type_t> by adding a new item to the xtd::collections::generic::list <type_t> and displaying the contents of the xtd::collections::object_model::read_only_collection <type_t>.
Finally, the code example creates an array larger than the collection and uses the xtd::collections::object_model::read_only_collection::copy_to method to insert the elements of the collection into the middle of the array.
|
inlinenodiscardoverridenoexcept |
Returns an enumerator that iterates through the xtd::collections::object_model::read_only_collection <type_t>.
After demonstrating the xtd::collections::object_model::read_only_collection::count, xtd::collections::object_model::read_only_collection::contains, xtd::collections::object_model::read_only_collection:: opertor [], and xtd::collections::generic::ilist::index_of members, the code example shows that the xtd::collections::object_model::read_only_collection <type_t> is just a wrapper for the original xtd::collections::generic::list <type_t> by adding a new item to the xtd::collections::generic::list <type_t> and displaying the contents of the xtd::collections::object_model::read_only_collection <type_t>.
Finally, the code example creates an array larger than the collection and uses the xtd::collections::object_model::read_only_collection::copy_to method to insert the elements of the collection into the middle of the array.
|
inlinenodiscardoverridenoexcept |
Searches for the specified object and returns the zero-based index of the first occurrence within the entire xtd::collections::object_model::read_only_collection <type_t>.
| item | The object to locate in the xtd::collections::object_model::read_only_collection <type_t>. |
After demonstrating the xtd::collections::object_model::read_only_collection::count, xtd::collections::object_model::read_only_collection::contains, xtd::collections::object_model::read_only_collection:: opertor [], and xtd::collections::generic::ilist::index_of members, the code example shows that the xtd::collections::object_model::read_only_collection <type_t> is just a wrapper for the original xtd::collections::generic::list <type_t> by adding a new item to the xtd::collections::generic::list <type_t> and displaying the contents of the xtd::collections::object_model::read_only_collection <type_t>.
Finally, the code example creates an array larger than the collection and uses the xtd::collections::object_model::read_only_collection::copy_to method to insert the elements of the collection into the middle of the array.
|
inlineoverride |
Returns a reference to the element at specified location pos.
| index | The position of the element to return. |
After demonstrating the xtd::collections::object_model::read_only_collection::count, xtd::collections::object_model::read_only_collection::contains, xtd::collections::object_model::read_only_collection:: opertor [], and xtd::collections::generic::ilist::index_of members, the code example shows that the xtd::collections::object_model::read_only_collection <type_t> is just a wrapper for the original xtd::collections::generic::list <type_t> by adding a new item to the xtd::collections::generic::list <type_t> and displaying the contents of the xtd::collections::object_model::read_only_collection <type_t>.
Finally, the code example creates an array larger than the collection and uses the xtd::collections::object_model::read_only_collection::copy_to method to insert the elements of the collection into the middle of the array.
|
inlineoverride |
Returns a reference to the element at specified location pos.
| index | The position of the element to return. |
| xtd::not_supported_exception | is always thrown. |
|
inlineprotectednoexcept |
Returns the xtd::collections::generic::ilist <type_t> that the xtd::collections::object_model::read_only_collection <type_t> wraps.
After demonstrating the xtd::collections::object_model::read_only_collection::count, xtd::collections::object_model::read_only_collection::contains, xtd::collections::object_model::read_only_collection:: opertor [], and xtd::collections::generic::ilist::index_of members, the code example shows that the xtd::collections::object_model::read_only_collection <type_t> is just a wrapper for the original xtd::collections::generic::list <type_t> by adding a new item to the xtd::collections::generic::list <type_t> and displaying the contents of the xtd::collections::object_model::read_only_collection <type_t>.
Finally, the code example creates an array larger than the collection and uses the xtd::collections::object_model::read_only_collection::copy_to method to insert the elements of the collection into the middle of the array.