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;
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 의 순서는 지정되지 않지만 메서드에서 ICollection 반환 Keys 된 연결된 키와 동일한 순서입니다.

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

이 속성의 값을 검색하는 것은 O(1) 작업입니다.

적용 대상