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:: operator [], 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::usize). | |
| 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 xtd::collections::generic::ilist< value_type > &listlist) | |
| 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::usize 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 |
| Gets an object that can be used to synchronize access to the the xtd::collections::generic::icollection <type_t>. | |
| 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::usize 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::usize 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>. | |
| auto | to_string () const noexcept -> xtd::string override |
| Returns a xtd::string that represents the current object. | |
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 | |
| using | value_type |
| Represents the xtd::collections::generic::icollection value type. | |
| using | value_type |
| Represents the xtd::collections::generic::ienumerable value type. | |
| using | iterator |
| Represents the iterator of xtd::collections::generic::ienumerable value type. | |
| using | const_iterator |
| Represents the const iterator of xtd::collections::generic::ienumerable value type. | |
| using | iterator |
| Represents the iterator of enumerable value type. | |
| using | const_iterator |
| Represents the const iterator of enumerable value type. | |
| using | enumerable_type |
| Represents the ienumerable enumerable type. | |
| using | source_type |
| Represents the ienumerable source type. | |
| using | ienumerable |
| Represents the ienumerable value type. | |
| using | list |
| Represents the list value type. | |
| static constexpr xtd::usize | npos |
| Represents a value that is not a valid position in a collection. | |
| static constexpr xtd::usize | bpos |
| Represents the index of the first valid element in a collection. | |
| static constexpr xtd::usize | epos |
| Represents the index of the last valid element in a collection. | |
| object ()=default | |
| Create a new instance of the ultimate base class object. | |
| virtual auto | equals (const object &obj) const noexcept -> bool |
| Determines whether the specified object is equal to the current object. | |
| virtual auto | get_hash_code () const noexcept -> xtd::usize |
| Serves as a hash function for a particular type. | |
| virtual auto | get_type () const noexcept -> type_object |
| Gets the type of the current instance. | |
| template<typename object_t> | |
| auto | memberwise_clone () const -> xtd::unique_ptr_object< object_t > |
| Creates a shallow copy of the current object. | |
| virtual auto | begin () const -> const_iterator |
| Returns an iterator to the first element of the enumerable. | |
| virtual auto | cbegin () const -> const_iterator |
| Returns an iterator to the first element of the enumerable. | |
| virtual auto | cend () const -> const_iterator |
| Returns an iterator to the element following the last element of the enumerable. | |
| virtual auto | end () const -> const_iterator |
| Returns an iterator to the element following the last element of the enumerable. | |
| auto | aggregate (const std::function< type_t(const type_t &, const type_t &)> &funcfunc) const -> type_t |
| Applies an accumulator function over a sequence. | |
| auto | all (const std::function< bool(const type_t &)> &predicatepredicate) const -> bool |
| Determines whether all elements of a sequence satisfy a condition. | |
| auto | any () const noexcept -> bool |
| Determines whether a sequence contains any elements. | |
| auto | append (const type_t &element) const noexcept |
| Appends a value to the end of the sequence. | |
| auto | as_enumerable () const noexcept |
| Returns the input typed as xtd::collections::generic::ienumerable <type_t>. | |
| auto | average () const noexcept |
| Computes the average of a sequence of source_t values. | |
| auto | cast () const noexcept |
| Casts the elements of an xtd::collections::generic::ienumerable to the specified type. | |
| auto | chunk (xtd::usize size) const |
| Splits the elements of a sequence into chunks of size at most size. | |
| auto | concat (const ienumerable< type_t > &second) const noexcept |
| Concatenates two sequences. | |
| auto | contains (const type_t &value) const noexcept -> bool |
| Determines whether a sequence contains a specified element by using the default equality comparer. | |
| auto | count () const noexcept -> xtd::usize |
| Returns the number of elements in current sequence. | |
| auto | count_by (const std::function< key_t(const type_t &)> &key_selector) const noexcept |
| Returns the count of elements in the current sequence grouped by key. | |
| auto | default_if_empty () const noexcept |
| Returns the elements of the specified sequence or the type parameter's default value in a singleton collection if the current sequence is empty. | |
| auto | distinct () const noexcept |
| Returns distinct elements from a sequence by using the default equality comparer to compare values. | |
| auto | first_or_default (const std::function< bool(const type_t &)> &predicatepredicate, const type_t &default_value) const noexcept -> type_t |
| Returns the first element of the sequence that satisfies a condition, or a specified default value if no such element is found. | |
| auto | order () const |
| Sorts the elements of a sequence in ascending order. | |
| auto | order_by (const std::function< type_t(const type_t &)> &key_selector) const |
| Sorts the elements of a sequence in ascending order according to a key. | |
| auto | order_by_descending (const std::function< key_t(const type_t &)> &key_selector) const |
| Sorts the elements of a sequence in descending order according to a key. | |
| auto | select (auto &&selector) const |
| Projects each element of a sequence into a new form. | |
| auto | to_array () const noexcept -> xtd::array< type_t > |
| Creates a xtd::array <type_t> from an xtd::collections::generic::ienumerable <type_t>. | |
| auto | to_list () const noexcept -> xtd::collections::generic::list< type_t > |
| Creates a xtd::collections::generic::list <type_t> from an xtd::collections::generic::ienumerable <type_t>. | |
| auto | where (auto &&predicatepredicate) const |
| Filters a sequence of values based on a predicate. | |
| virtual auto | empty () const noexcept -> bool |
| Checks whether the container is empty. | |
| virtual auto | size () const noexcept -> xtd::usize |
| Gets the number of elements contained in the xtd::collections::generic::icollection <type_t>. | |
| virtual auto | operator<< (const type_t &item) -> icollection< type_t > & |
| The shift left operator adds an item to the xtd::collections::generic::icollection <type_t>. | |
| virtual auto | operator>> (const type_t &item) -> icollection< type_t > & |
| The shift right operator removes the first occurrence of a specific object from the xtd::collections::generic::icollection <type_t>. | |
| template<typename object_a_t, typename object_b_t> | |
| static auto | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool |
| Determines whether the specified object instances are considered equal. | |
| template<typename object_a_t, typename object_b_t> | |
| static auto | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool |
| Determines whether the specified object instances are the same instance. | |
| static auto | to_const_iterator (typename source_collection_t::const_iterator &value, const source_collection_t &source_collection, const target_collection_t &target_collection) noexcept -> typename target_collection_t::const_iterator |
| Converts source iterator to target iterator. | |
| static auto | to_iterator (typename source_collection_t::const_iterator &value, const source_collection_t &source_collection, const target_collection_t &target_collection) noexcept -> typename target_collection_t::const_iterator |
| Converts source iterator to target iterator. | |
| 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::usize).
| 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:: operator [], 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.
|
inlinenodiscardoverridevirtualnoexcept |
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:: operator [], 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.
Implements xtd::collections::generic::ilist< type_t >.
|
inlinestaticnodiscard |
Gets an empty xtd::collections::object_model::read_only_collection <type_t>.
|
inlinenodiscardoverridevirtualnoexcept |
Gets an object that can be used to synchronize access to the the xtd::collections::generic::icollection <type_t>.
Implements xtd::collections::generic::ilist< type_t >.
|
inlinenodiscardoverridevirtualnoexcept |
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:: operator [], 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.
Implements xtd::collections::generic::ilist< type_t >.
|
inlineoverridevirtual |
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:: operator [], 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.
Implements xtd::collections::generic::ilist< type_t >.
|
inlinenodiscardoverridevirtualnoexcept |
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:: operator [], 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.
Implements xtd::collections::generic::ilist< type_t >.
|
inlinenodiscardoverridevirtualnoexcept |
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:: operator [], 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.
Implements xtd::collections::generic::ilist< type_t >.
|
inlinenodiscardoverridevirtualnoexcept |
Returns a xtd::string that represents the current object.
Reimplemented from xtd::object.
|
inlineoverridevirtual |
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:: operator [], 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.
Implements xtd::collections::generic::ilist< type_t >.
|
inlineoverridevirtual |
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. |
Implements xtd::collections::generic::ilist< type_t >.
|
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:: operator [], 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.