JsonReadOnlyProxyInt32DictionaryOfArray<TValue, TProxy>

Namespace: SnowBank.Data.Json · struct

Implements: IReadOnlyDictionary<int, JsonReadOnlyProxyArray<TValue, TProxy>>, IEnumerable<KeyValuePair<int, JsonReadOnlyProxyArray<TValue, TProxy>>>, IEnumerable, IReadOnlyCollection<KeyValuePair<int, JsonReadOnlyProxyArray<TValue, TProxy>>>, IJsonSerializable, IJsonPackable

Wraps a JsonObject into a typed read-only proxy that emulates a dictionary of elements of type TValue with integer keys

Remarks

The keys in the JSON Object must be base-10 encoded integers (ex: "0", "123", "-456").

Constructors

JsonReadOnlyProxyInt32DictionaryOfArray<TValue, TProxy>

JsonReadOnlyProxyInt32DictionaryOfArray<TValue, TProxy>(ObservableJsonValue value)

Properties

Count

int Count { get; }

Item

JsonReadOnlyProxyArray<TValue, TProxy> Item { get; }

Keys

IEnumerable<int> Keys { get; }

Values

IEnumerable<JsonReadOnlyProxyArray<TValue, TProxy>> Values { get; }

Methods

ContainsKey

bool ContainsKey(int key)

Exists

bool Exists()

Tests if the object is present.

Returns: false if the wrapped JSON value is null or empty; otherwise, true.

GetEnumerator

IEnumerator<KeyValuePair<int, JsonReadOnlyProxyArray<TValue, TProxy>>> GetEnumerator()

IsNullOrEmpty

bool IsNullOrEmpty()

Tests if the object is null, missing, or empty.

Returns: true if the wrapped JSON value is null, missing or an empty object; otherwise, false.

This can return false if the wrapped value is an empty object, or another type, like an array, string literal, etc...

IsNullOrMissing

bool IsNullOrMissing()

Tests if the object is null or missing.

Returns: true if the wrapped JSON value is null or missing; otherwise, false.

This can return false if the wrapped value is another type, like an array, string literal, etc...

IsObject

bool IsObject()

Tests if the wrapped value is a valid JSON Object.

Returns: true if the wrapped JSON value is a non-null Object; otherwise, false

This can be used to protect against malformed JSON document that would have a different type (array, string literal, ...).

IsObjectOrMissing

bool IsObjectOrMissing()

Tests if the wrapped value is a valid JSON Object, or is null-or-missing.

Returns: true if the wrapped JSON value either null-or-missing, or an Object; otherwise, false

This can be used to protect against malformed JSON document that would have a different type (array, string literal, ...).

ToDictionary

Dictionary<string, TValue> ToDictionary()

ToJsonValue

JsonValue ToJsonValue()

ToString

string ToString()

TryGetValue

bool TryGetValue(int key, out JsonReadOnlyProxyArray<TValue, TProxy> value)