ApplicationDataCompositeValue 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
원자성으로 직렬화 및 역직렬화해야 하는 관련 앱 설정을 나타냅니다.
public ref class ApplicationDataCompositeValue 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.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
class ApplicationDataCompositeValue final : IIterable<IKeyValuePair<winrt::hstring, IInspectable const&>>, IMap<winrt::hstring, IInspectable const&>, IObservableMap<winrt::hstring, IInspectable const&>, IPropertySet
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
/// [Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
class ApplicationDataCompositeValue 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.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
public sealed class ApplicationDataCompositeValue : IDictionary<string,object>, IEnumerable<KeyValuePair<string,object>>, IObservableMap<string,object>, IPropertySet
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
[Windows.Foundation.Metadata.Activatable(65536, "Windows.Foundation.UniversalApiContract")]
public sealed class ApplicationDataCompositeValue : IDictionary<string,object>, IEnumerable<KeyValuePair<string,object>>, IObservableMap<string,object>, IPropertySet
function ApplicationDataCompositeValue()
Public NotInheritable Class ApplicationDataCompositeValue
Implements IDictionary(Of String, Object), IEnumerable(Of KeyValuePair(Of String, Object)), IObservableMap(Of String, Object), IPropertySet
- 상속
- 특성
- 구현
-
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.UniversalApiContract (v1.0에서 도입되었습니다.)
|
예제
이 예제에서는 라는 exampleCompositeSetting
복합 설정을 만들고 읽습니다.
설정을 완료하면 Remove 메서드를 exampleCompositeSetting
호출하여 설정을 삭제합니다.
Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
// Create a composite setting
Windows.Storage.ApplicationDataCompositeValue composite = new Windows.Storage.ApplicationDataCompositeValue();
composite["intVal"] = 1;
composite["strVal"] = "string";
localSettings.Values["exampleCompositeSetting"] = composite;
// Read data from a composite setting
Windows.Storage.ApplicationDataCompositeValue composite =
(Windows.Storage.ApplicationDataCompositeValue)localSettings.Values["exampleCompositeSetting"];
if (composite == null)
{
// No data
}
else
{
// Access data in composite["intVal"] and composite["strVal"]
}
// Delete a composite setting
localSettings.Values.Remove("exampleCompositeSetting");
Windows::Storage::ApplicationDataContainer localSettings{
Windows::Storage::ApplicationData::Current().LocalSettings() };
auto values{ localSettings.Values() };
{
// Create a composite setting.
Windows::Storage::ApplicationDataCompositeValue composite;
composite.Insert(L"intVal", Windows::Foundation::PropertyValue::CreateInt32(1));
composite.Insert(L"strVal", Windows::Foundation::PropertyValue::CreateString(L"string"));
values.Insert(L"exampleCompositeSetting", composite);
}
{
// Read data from a composite setting.
Windows::Storage::ApplicationDataCompositeValue composite{ values.Lookup(L"exampleCompositeSetting").as<Windows::Storage::ApplicationDataCompositeValue>() };
if (composite == nullptr)
{
// No data
}
else
{
int32_t one{ winrt::unbox_value<int32_t>(composite.Lookup(L"intVal")) };
winrt::hstring hello{ winrt::unbox_value<winrt::hstring>(composite.Lookup(L"strVal")) };
}
}
// Delete a composite setting.
values.Remove(L"exampleCompositeSetting");
ApplicationDataContainer^ localSettings = ApplicationData::Current->LocalSettings;
// Create a composite setting
ApplicationDataCompositeValue^ composite = ref new ApplicationDataCompositeValue();
composite->Insert("intVal", dynamic_cast<PropertyValue^>(PropertyValue::CreateInt32(1)));
composite->Insert("strVal", dynamic_cast<PropertyValue^>(PropertyValue::CreateString("string")));
auto values = localSettings->Values;
values->Insert("exampleCompositeSetting", composite);
// Read data from a composite setting
composite = safe_cast<ApplicationDataCompositeValue^>(localSettings->Values->Lookup("exampleCompositeSetting"));
if (composite == nullptr)
{
// No data
}
else
{
int one = safe_cast<IPropertyValue^>(composite->Lookup("intVal"))->GetInt32();
String^ hello = safe_cast<String^>(composite->Lookup("strVal"));
}
// Delete a composite setting
values->Remove("exampleCompositeSetting");
Dim localSettings As Windows.Storage.ApplicationDataContainer = Windows.Storage.ApplicationData.Current.LocalSettings
' Create a composite setting
Dim composite As New Windows.Storage.ApplicationDataCompositeValue
composite("intVal") = 1
composite("strVal") = "string";
localSettings.Values("exampleCompositeSetting") = composite
' Read data from a composite setting
Dim composite As Windows.Storage.ApplicationDataCompositeValue =
CType(localSettings.Values("exampleCompositeSetting"), Windows.Storage.ApplicationDataCompositeValue)
If composite Is Nothing Then
' No data
Else
' Access data in composite("intVal") and composite("strVal")
End If
' Delete a composite setting
localSettings.Values.Remove("exampleCompositeSetting")
설명
복합 설정은 설정 맵에 삽입하여 직렬화되고 지도에서 조회하여 역직렬화됩니다.
컬렉션 멤버 목록
JavaScript의 경우 ApplicationDataCompositeValue는 인덱스를 사용하여 항목에 액세스하도록 지원합니다.
생성자
ApplicationDataCompositeValue() |
개체의 처음 비어 있는 새 instance 만들고 초기화합니다. |
속성
Size |
관련 애플리케이션 설정의 수를 가져옵니다. |
메서드
Clear() |
이전에 복합 값 개체에 삽입된 모든 애플리케이션 설정을 제거하고 개체를 빈 상태로 되돌깁니다. |
First() |
복합 값의 설정을 열거하는 반복기를 검색합니다. |
GetView() |
복합 값 내용의 읽기 전용 스냅샷 반환합니다. |
HasKey(String) |
지정된 키를 사용하는 애플리케이션 설정이 있는지 여부를 확인합니다. |
Insert(String, Object) |
애플리케이션 설정을 만들거나 대체합니다. |
Lookup(String) |
지정된 애플리케이션 설정을 검색합니다. |
Remove(String) |
지정된 키를 사용하여 값을 제거합니다. |
이벤트
MapChanged |
맵이 변경되면 발생합니다. |