SortedSet<T>.GetViewBetween(T, T) Método

Definição

Retorna uma exibição de um subconjunto em um 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)

Parâmetros

lowerValue
T

O menor valor desejado no modo de exibição.The lowest desired value in the view.

upperValue
T

O maior valor desejado no modo de exibição.The highest desired value in the view.

Retornos

SortedSet<T>

Uma exibição de subconjunto que contém apenas os valores no intervalo especificado.A subset view that contains only the values in the specified range.

Exceções

lowerValue é mais do que upperValue acordo com o comparador.lowerValue is more than upperValue according to the comparer.

Uma tentativa de operação na exibição estava fora do intervalo especificado por lowerValue e upperValue.A tried operation on the view was outside the range specified by lowerValue and upperValue.

Exemplos

O exemplo a seguir usa o GetViewBetween método para listar somente os arquivos AVI de um conjunto classificado de nomes de arquivos de mídia.The following example uses the GetViewBetween method to list only the AVI files from a sorted set of media file names. O comparador avalia os nomes de arquivo de acordo com suas extensões.The comparer evaluates file names according to their extensions. O lowerValue é "avi" e o upperValue é apenas um valor superior, "AVJ", para obter a exibição de todos os arquivos AVI.The lowerValue is "AVI" and the upperValue is only one value higher, "AVJ", to get the view of all AVI files. Este exemplo de código faz parte de um exemplo maior fornecido para a SortedSet<T> classe.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

Comentários

Esse método retorna uma exibição do intervalo de elementos que estão entre lowerValue e upperValue , conforme definido pelo comparador.This method returns a view of the range of elements that fall between lowerValue and upperValue, as defined by the comparer. Esse método não copia elementos do SortedSet<T> , mas fornece uma janela para o SortedSet<T> próprio subjacente.This method does not copy elements from the SortedSet<T>, but provides a window into the underlying SortedSet<T> itself. Você pode fazer alterações no modo de exibição e no subjacente SortedSet<T> .You can make changes in both the view and in the underlying SortedSet<T>.

Aplica-se a