Click or drag to resize
OrderedBagTView Class
The OrderedBag<T>.View class is used to look at a subset of the items inside an ordered bag. It is returned from the Range, RangeTo, RangeFrom, and Reversed methods.
Inheritance Hierarchy
SystemObject
  X3Platform.CollectionsCollectionBaseT
    X3Platform.CollectionsOrderedBagTView

Namespace: X3Platform.Collections
Assembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntax
[SerializableAttribute]
public class View : CollectionBase<T>

The OrderedBagTView generic type exposes the following members.

Methods
  NameDescription
Public methodAdd
Adds a new item to the bag underlying this View. If the bag already contains an item equal to item, that item is replaces with item. If item is outside the range of this view, an InvalidOperationException is thrown.
(Overrides CollectionBaseTAdd(T).)
Public methodAsList
Get a read-only list view of the items in this view. The items in the list are in sorted order, with the smallest item at index 0. This view does not copy any data, and reflects any changes to the underlying OrderedSet.
Public methodAsReadOnly
Provides a read-only view of this collection. The returned ICollection<T> provides a view of the collection that prevents modifications to the collection. Use the method to provide access to the collection without allowing changes. Since the returned object is just a view, changes to the collection will be reflected in the view.
(Inherited from CollectionBaseT.)
Public methodCode exampleClear
Removes all the items within this view from the underlying bag.
(Overrides CollectionBaseTClear.)
Public methodContains
Determines if this view of the bag contains an item equal to item. The bag is not changed. If
(Overrides CollectionBaseTContains(T).)
Public methodConvertAllTOutput
Convert this collection of items by applying a delegate to each item in the collection. The resulting enumeration contains the result of applying converter to each item in this collection, in order.
(Inherited from CollectionBaseT.)
Public methodCopyTo
Copies all the items in the collection into an array. Implemented by using the enumerator returned from GetEnumerator to get all the items and copy them to the provided array.
(Inherited from CollectionBaseT.)
Public methodCountWhere
Counts the number of items in the collection that satisfy the condition defined by predicate.
(Inherited from CollectionBaseT.)
Public methodEquals (Inherited from Object.)
Public methodExists
Determines if the collection contains any item that satisfies the condition defined by predicate.
(Inherited from CollectionBaseT.)
Protected methodFinalize (Inherited from Object.)
Public methodFindAll
Enumerates the items in the collection that satisfy the condition defined by predicate.
(Inherited from CollectionBaseT.)
Public methodForEach
Performs the specified action on each item in this collection.
(Inherited from CollectionBaseT.)
Public methodGetEnumerator
Enumerate all the items in this view.
(Overrides CollectionBaseTGetEnumerator.)
Public methodGetFirst
Returns the first item in this view: the item that would appear first if the view was enumerated.
Public methodGetHashCode (Inherited from Object.)
Public methodGetLast
Returns the last item in the view: the item that would appear last if the view was enumerated.
Public methodGetType (Inherited from Object.)
Public methodIndexOf
Get the first index of the given item in the view. The smallest item in the view has index 0, the next smallest item has index 1, and the largest item has index Count-1.
Public methodLastIndexOf
Get the last index of the given item in the view. The smallest item in the view has index 0, the next smallest item has index 1, and the largest item has index Count-1.
Protected methodMemberwiseClone (Inherited from Object.)
Public methodRemove
Searches the underlying bag for an item equal to item, and if found, removes it from the bag. If not found, the bag is unchanged. If the item is outside the range of this view, the bag is unchanged.
(Overrides CollectionBaseTRemove(T).)
Public methodRemoveAll
Removes all the items in the collection that satisfy the condition defined by predicate.
(Inherited from CollectionBaseT.)
Public methodReversed
Creates a new View that has the same items as this view, in the reversed order.
Public methodToArray
Creates an array of the correct size, and copies all the items in the collection into the array, by calling CopyTo.
(Inherited from CollectionBaseT.)
Public methodToString
Shows the string representation of the collection. The string representation contains a list of the items in the collection. Contained collections (except string) are expanded recursively.
(Inherited from CollectionBaseT.)
Public methodTrueForAll
Determines if all of the items in the collection satisfy the condition defined by predicate.
(Inherited from CollectionBaseT.)
Top
Properties
  NameDescription
Public propertyCount
Number of items in this view.
(Overrides CollectionBaseTCount.)
Public propertyItem
Get the item by its index in the sorted order. The smallest item in the view has index 0, the next smallest item has index 1, and the largest item has index Count-1.
Top
Remarks

Views are dynamic. If the underlying bag changes, the view changes in sync. If a change is made to the view, the underlying bag changes accordingly.

Typically, this class is used in conjunction with a foreach statement to enumerate the items in a subset of the OrderedBag. For example:

foreach(T item in bag.Range(from, to)) {
   // process item
}
See Also