xtd 0.2.0
Loading...
Searching...
No Matches

◆ as_read_only()

template<typename type_t , typename allocator_t = xtd::collections::generic::helpers::allocator<typename std::conditional<std::is_same<bool, type_t>::value, char, type_t>::type>>
read_only_collection xtd::collections::generic::list< type_t, allocator_t >::as_read_only ( ) const
inlinenoexcept

Returns a read-only xtd::collections::object_model::read_only_collection <type_t> wrapper for the current collection.

Returns
An object that acts as a read-only wrapper around the current xtd::collections::generic::list <type_t>.
Remarks
To prevent any modifications to the xtd::collections::generic::list <type_t> object, expose it only through this wrapper. A xtd::collections::object_model::read_only_collection <type_t> object does not expose methods that modify the collection. However, if changes are made to the underlying xtd::collections::generic::list <type_t> object, the read-only collection reflects those changes.
This method is an O(1) operation.