SortedSet<'T>.GetViewBetween Method ('T, 'T)
Returns a view of a subset in a SortedSet<'T>.
Assembly: System (in System.dll)
abstract GetViewBetween : lowerValue:'T * upperValue:'T -> SortedSet<'T> override GetViewBetween : lowerValue:'T * upperValue:'T -> SortedSet<'T>
Parameters
- lowerValue
-
Type:
T
The lowest desired value in the view.
- upperValue
-
Type:
T
The highest desired value in the view.
Return Value
Type: System.Collections.Generic.SortedSet<'T>A subset view that contains only the values in the specified range.
| Exception | Condition |
|---|---|
| ArgumentException | lowerValue is more than upperValue according to the comparer. |
| ArgumentOutOfRangeException | A tried operation on the view was outside the range specified by lowerValue and upperValue. |
This method returns a view of the range of elements that fall between lowerValue and upperValue, as defined by the comparer. This method does not copy elements from the SortedSet<'T>, but provides a window into the underlying SortedSet<'T> itself. You can make changes in both the view and in the underlying SortedSet<'T>.
The following example uses the GetViewBetween method to list only the AVI files from a sorted set of media file names. The comparer evaluates file names according to their extensions. The lowerValue is "AVI" and the upperValue is only one value higher, "AVJ", to get the view of all AVI files. This code example is part of a larger example provided for the SortedSet<'T> class.
Available since 8
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Windows Phone Silverlight
Available since 8.0
Windows Phone
Available since 8.1