StringDictionary.Values 속성

정의

StringDictionary에 있는 값의 컬렉션을 가져옵니다.

public:
 virtual property System::Collections::ICollection ^ Values { System::Collections::ICollection ^ get(); };
public virtual System.Collections.ICollection Values { get; }
member this.Values : System.Collections.ICollection
Public Overridable ReadOnly Property Values As ICollection

속성 값

ICollection의 값을 제공하는 StringDictionary입니다.

예제

다음 코드 예제에서는 의 요소를 열거합니다 StringDictionary.

#using <System.dll>

using namespace System;
using namespace System::Collections;
using namespace System::Collections::Specialized;

public ref class SamplesStringDictionary
{
public:
    static void Main()
    {
        // Creates and initializes a new StringDictionary.
        StringDictionary^ myCol = gcnew StringDictionary();
        myCol->Add( "red", "rojo" );
        myCol->Add( "green", "verde" );
        myCol->Add( "blue", "azul" );

        Console::WriteLine("VALUES");
        for each (String^ val in myCol->Values)
        {
            Console::WriteLine(val);
        }
    }
};

int main()
{
    SamplesStringDictionary::Main();
}
// This code produces the following output.
// VALUES
// verde
// rojo
// azul
using System;
using System.Collections;
using System.Collections.Specialized;

public class SamplesStringDictionary
{
    public static void Main()
    {
        // Creates and initializes a new StringDictionary.
        StringDictionary myCol = new StringDictionary();
        myCol.Add( "red", "rojo" );
        myCol.Add( "green", "verde" );
        myCol.Add( "blue", "azul" );

        Console.WriteLine("VALUES");
        foreach (string val in myCol.Values)
        {
            Console.WriteLine(val);
        }
    }
}
// This code produces the following output.
// VALUES
// verde
// rojo
// azul
Imports System.Collections
Imports System.Collections.Specialized

Public Class SamplesStringDictionary
    Public Shared Sub Main()
        ' Creates and initializes a new StringDictionary.
        Dim myCol As New StringDictionary()
        myCol.Add( "red", "rojo" )
        myCol.Add( "green", "verde" )
        myCol.Add( "blue", "azul" )

        Console.WriteLine("VALUES")
        For Each val As String In myCol.Values
            Console.WriteLine(val)
        Next val
    End Sub
End Class

' This code produces the following output.
'
' VALUES
' verde
' rojo
' azul

설명

ICollection 값 순서는 지정되지 않지만 메서드에서 반환 Keys 된 의 연결된 키 ICollection 와 동일한 순서입니다.

반환 ICollection 된 는 정적 복사본 ICollection 이 아니라 원래 StringDictionary의 값을 다시 참조합니다. 따라서 에 대한 StringDictionary 변경 내용은 에 계속 반영됩니다 ICollection.

이 속성 값을 검색하는 것은 O(1) 연산입니다.

적용 대상