-
Notifications
You must be signed in to change notification settings - Fork 4.6k
/
SearchDocument.Dictionary.cs
79 lines (62 loc) · 2.67 KB
/
SearchDocument.Dictionary.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using System.Collections;
using System.Collections.Generic;
// This logic belongs in DynamicData, but they may not ship at the same time
// so we optionally compile a version of it into SearchDocument.
#if EXPERIMENTAL_DYNAMIC
namespace Azure.Core
{
public partial class DynamicData
#else
namespace Azure.Search.Documents.Models
{
public partial class SearchDocument
#endif
: IDictionary<string, object>
{
/// <inheritdoc />
public object this[string key]
{
get => GetValue(key);
set => SetValue(key, value);
}
/// <inheritdoc />
public bool TryGetValue(string key, out object value) =>
TryGetValue(key, typeof(object), out value);
/// <inheritdoc />
public ICollection<string> Keys => _values.Keys;
/// <inheritdoc cref="IDictionary{TKey, TValue}.Values" />
ICollection<object> IDictionary<string, object>.Values => _values.Values;
/// <inheritdoc />
public int Count => _values.Count;
/// <inheritdoc cref="ICollection{T}.IsReadOnly" />
bool ICollection<KeyValuePair<string, object>>.IsReadOnly => _values.IsReadOnly;
/// <inheritdoc />
public void Add(string key, object value) => SetValue(key, value);
/// <inheritdoc />
public bool ContainsKey(string key) => _values.ContainsKey(key);
/// <inheritdoc cref="ICollection{T}.Add" />
void ICollection<KeyValuePair<string, object>>.Add(KeyValuePair<string, object> item) =>
SetValue(item.Key, item.Value);
/// <inheritdoc cref="ICollection{T}.Contains" />
bool ICollection<KeyValuePair<string, object>>.Contains(KeyValuePair<string, object> item) =>
_values.Contains(item);
/// <inheritdoc cref="ICollection{T}.CopyTo" />
void ICollection<KeyValuePair<string, object>>.CopyTo(KeyValuePair<string, object>[] array, int arrayIndex) =>
_values.CopyTo(array, arrayIndex);
/// <inheritdoc />
public IEnumerator<KeyValuePair<string, object>> GetEnumerator() =>
_values.GetEnumerator();
/// <inheritdoc />
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
/// <inheritdoc />
public bool Remove(string key) => _values.Remove(key);
/// <inheritdoc cref="ICollection{T}.Remove" />
bool ICollection<KeyValuePair<string, object>>.Remove(KeyValuePair<string, object> item) =>
_values.Remove(item);
/// <inheritdoc />
public void Clear() => _values.Clear();
}
}