PropertySet 클래스

정의

문자열 키가 있는 PropertyValue 개체 집합인 속성 집합을 나타냅니다.

public ref class PropertySet sealed : IIterable<IKeyValuePair<Platform::String ^, Platform::Object ^> ^>, IMap<Platform::String ^, Platform::Object ^>, IObservableMap<Platform::String ^, Platform::Object ^>, IPropertySet
/// [Windows.Foundation.Metadata.Activatable(65536, Windows.Foundation.FoundationContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.FoundationContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class PropertySet final : IIterable<IKeyValuePair<winrt::hstring, IInspectable const&>>, IMap<winrt::hstring, IInspectable const&>, IObservableMap<winrt::hstring, IInspectable const&>, IPropertySet
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.FoundationContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.FoundationContract")]
class PropertySet final : IIterable<IKeyValuePair<winrt::hstring, IInspectable const&>>, IMap<winrt::hstring, IInspectable const&>, IObservableMap<winrt::hstring, IInspectable const&>, IPropertySet
[Windows.Foundation.Metadata.Activatable(65536, typeof(Windows.Foundation.FoundationContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.FoundationContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class PropertySet : IDictionary<string,object>, IEnumerable<KeyValuePair<string,object>>, IObservableMap<string,object>, IPropertySet
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.FoundationContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.FoundationContract")]
public sealed class PropertySet : IDictionary<string,object>, IEnumerable<KeyValuePair<string,object>>, IObservableMap<string,object>, IPropertySet
function PropertySet()
Public NotInheritable Class PropertySet
Implements IDictionary(Of String, Object), IEnumerable(Of KeyValuePair(Of String, Object)), IObservableMap(Of String, Object), IPropertySet
상속
Object Platform::Object IInspectable PropertySet
특성
구현
IMap<K,V> IDictionary<K,V> IMap<String,Object> IDictionary<String,Object> IMap<Platform::String,Platform::Object> IMap<winrt::hstring,IInspectable> IIterable<IKeyValuePair<K,V>> IEnumerable<KeyValuePair<K,V>> IIterable<IKeyValuePair<String,Object>> IEnumerable<KeyValuePair<String,Object>> IIterable<IKeyValuePair<Platform::String,Platform::Object>> IIterable<IKeyValuePair<winrt::hstring,IInspectable>> IObservableMap<String,Object> IObservableMap<Platform::String,Platform::Object> IObservableMap<winrt::hstring,IInspectable> IPropertySet

Windows 요구 사항

디바이스 패밀리
Windows 10 (10.0.10240.0에서 도입되었습니다.)
API contract
Windows.Foundation.FoundationContract (v1.0에서 도입되었습니다.)

설명

이 클래스는 String 형식의 키와 PropertyValue 형식의 값을 사용하여 맵(IMap<K,V> 인터페이스)을 구현합니다. PropertySet 형식을 사용하면 다양한 Windows 런타임 API가 앱에서 사용하는 언어에 따라 IMap<K, V>, IDictionary<TKey, TValue> 또는 JavaScript 컬렉션 및 열거형 기술과 일치하는 PropertySet의 공통 컬렉션 API를 사용하여 계속 반복하거나 검사할 수 있는 혼합 값 컬렉션을 반환할 수 있습니다.

PropertyValue 는 일반적으로 값 형식 또는 기본 형식(부울, 숫자 등) 또는 해당 값의 배열인 입력에서 의도적으로 형식화되지 않은 값을 만드는 많은 수의 정적 Create* 메서드를 지원하는 클래스입니다. 정적 PropertyValue 메서드 중 하나가 호출되면 해당 반환 값은 PropertyValue instance 처리될 수 있습니다(그러나 서명을 살펴보면 Create* 메서드는 기술적으로 Object를 반환합니다).

그러나 일반적으로 Set에서 PropertyValue 값을 직접 채워야 하는 방식으로 PropertySet을 사용하지는 않습니다. 대신 일반적으로 채워진 PropertySet을 Windows 런타임 API에서 반환 값으로 가져오는데, 이 API는 컬렉션 내의 값 형식이 혼합될 수 있지만 원본 또는 시나리오에 따라 서로 관련되어 있는 컬렉션을 제공합니다. 예를 들어 앱 데이터를 검색할 때 가져오는 LocalSettingsRoamingSettings 값은 ApplicationDataContainer 형식이며 각각은 PropertySet을 Values 속성 값으로 포함합니다. 설정을 저장하는 앱 데이터와 상호 작용하는 경우 일반적으로 ApplicationDataContainer.Values에서 컬렉션을 가져옵니다. 그런 다음 다음을 수행할 수 있습니다.

  • 적절한 반복 구문을 사용하여 집합을 반복합니다.
  • HasKey/ContainsKey를 사용하여 집합에 PropertyValue가 있는지 확인합니다.
  • 항목이 있다는 것을 알게 되면 조회 또는 항목 인덱서를 사용하여 항목을 검색합니다.

앱 데이터 작업과 같은 시나리오의 경우 PropertySet을 참조하여 사용할 수 있으므로 삽입 추가/를 사용하여 PropertySet에 항목을 추가하면 이러한 항목이 앱 데이터에 추가되고 항목을 제거하면 앱 데이터에서 제거됩니다. 그러면 이러한 모든 변경 내용이 RoamingSettings에 적용된 경우 앱 데이터 메커니즘을 통해 공유됩니다.

ApplicationDataContainer와 같은 다른 클래스에 래핑되지 않고 PropertySet 값을 직접 값으로 사용하는 다른 Windows 런타임 API가 있습니다. 예를 들어 CoreApplication.Properties는 PropertySet를 반환합니다.

미디어 및 디바이스에서 정보를 보고하는 다양한 속성은 PropertySet(예: PlayToReceiver.Properties)을 사용합니다. 그러나 PropertySet을 사용하지 않고 대신 MediaPropertySet을 사용하는 다른 미디어/디바이스 속성 집합이 있습니다. 이러한 속성의 식별자는 문자열이 아닌 GUID 로 키가 지정될 때 더 잘 표현되기 때문입니다.

Windows 런타임 API가 PropertySet을 값으로 사용하는 대부분의 경우 실제로 서명에 IPropertySet으로 표시됩니다. PropertySet은 앱 코드에서 사용할 준비가 된 IPropertySet 의 실제 구현으로 간주될 수 있습니다. JavaScript 코드는 PropertySet 프로토타입을 구현한 것처럼 모든 IPropertySet 값을 처리할 수 있습니다.

컬렉션 멤버 목록

JavaScript의 경우 PropertySet은 인덱스를 사용하여 항목에 액세스할 수 있도록 지원합니다.

생성자

PropertySet()

속성 집합의 새 instance 만들고 초기화합니다.

속성

Size

속성 집합에 포함된 항목 수를 가져옵니다.

메서드

Clear()

속성 집합에서 모든 항목을 제거합니다.

First()

속성 집합의 항목을 열거하는 반복기를 반환합니다.

GetView()

속성 집합의 변경할 수 없는 보기를 가져옵니다.

HasKey(String)

속성 집합에 지정된 키가 있는 항목이 있는지 여부를 나타냅니다.

Insert(String, Object)

속성 집합에 항목을 추가합니다.

Lookup(String)

지정된 키의 값을 검색합니다.

Remove(String)

속성 집합에서 항목을 제거합니다.

이벤트

MapChanged

관찰 가능한 맵이 변경되면 발생합니다.

적용 대상

추가 정보