SortedSet<T>.GetViewBetween(T, T) メソッド
定義
SortedSet<T> 内のサブセットのビューを返します。Returns a view of a subset in a SortedSet<T>.
public:
virtual System::Collections::Generic::SortedSet<T> ^ GetViewBetween(T lowerValue, T upperValue);
public virtual System.Collections.Generic.SortedSet<T> GetViewBetween (T lowerValue, T upperValue);
public virtual System.Collections.Generic.SortedSet<T> GetViewBetween (T? lowerValue, T? upperValue);
abstract member GetViewBetween : 'T * 'T -> System.Collections.Generic.SortedSet<'T>
override this.GetViewBetween : 'T * 'T -> System.Collections.Generic.SortedSet<'T>
Public Overridable Function GetViewBetween (lowerValue As T, upperValue As T) As SortedSet(Of T)
パラメーター
- lowerValue
- T
目的のビューの範囲の最小値。The lowest desired value in the view.
- upperValue
- T
目的のビューの範囲の最大値。The highest desired value in the view.
戻り値
指定された範囲の値だけを含むサブセット ビュー。A subset view that contains only the values in the specified range.
例外
比較子に照らすと、lowerValue
が upperValue
を超えています。lowerValue
is more than upperValue
according to the comparer.
ビューで試行された操作が、lowerValue
および upperValue
で指定された範囲外です。A tried operation on the view was outside the range specified by lowerValue
and upperValue
.
例
次の例では、メソッドを使用して、 GetViewBetween メディアファイル名の並べ替えられたセットから AVI ファイルのみを一覧表示します。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. は lowerValue
"avi" であり、は、 upperValue
すべての avi ファイルのビューを取得するために、"avj" という値が1つだけあります。The lowerValue
is "AVI" and the upperValue
is only one value higher, "AVJ", to get the view of all AVI files. このコード例は、SortedSet<T> クラスのために提供されている大規模な例の一部です。This code example is part of a larger example provided for the SortedSet<T> class.
// List all the avi files.
SortedSet<string> aviFiles = mediaFiles1.GetViewBetween("avi", "avj");
Console.WriteLine("AVI files:");
foreach (string avi in aviFiles)
{
Console.WriteLine($"\t{avi}");
}
' List all the avi files.
Dim aviFiles As SortedSet(Of String) = mediaFiles1.GetViewBetween("avi", "avj")
Console.WriteLine("AVI files:")
For Each avi As String In aviFiles
Console.WriteLine($"{vbTab}{avi}")
Next
注釈
このメソッドは、 lowerValue
upperValue
比較子によって定義されている、との間にある要素の範囲のビューを返します。This method returns a view of the range of elements that fall between lowerValue
and upperValue
, as defined by the comparer. このメソッドは、から要素をコピーしません SortedSet<T> が、基になるにウィンドウを提供 SortedSet<T> します。This method does not copy elements from the SortedSet<T>, but provides a window into the underlying SortedSet<T> itself. ビューと、基になるの両方で変更を加えることができ SortedSet<T> ます。You can make changes in both the view and in the underlying SortedSet<T>.