JsonReadOnlyProxyArray<TValue, TProxy>

Namespace: SnowBank.Data.Json · struct

Implements: IReadOnlyList<TProxy>, IEnumerable<TProxy>, IEnumerable, IReadOnlyCollection<TProxy>, IJsonSerializable, IJsonPackable

Wraps a JsonArray into a typed read-only proxy that emulates an array of elements of type TValue

Constructors

JsonReadOnlyProxyArray<TValue, TProxy>

JsonReadOnlyProxyArray<TValue, TProxy>(ObservableJsonValue value)

Properties

Count

int Count { get; }

Item

TProxy Item { get; }

TProxy Item { get; }

Methods

Exists

bool Exists()

Tests if the array is present.

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

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

Get

TProxy Get(int index)

TProxy Get(Index index)

GetEnumerator

IEnumerator<TProxy> GetEnumerator()

IsArray

bool IsArray()

Tests if the wrapped value is a valid JSON Array.

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

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

IsArrayOrMissing

bool IsArrayOrMissing()

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

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

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

IsNullOrEmpty

bool IsNullOrEmpty()

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

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

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

IsNullOrMissing

bool IsNullOrMissing()

Tests if the array 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 object, string literal, etc...

ToJsonValue

JsonValue ToJsonValue()

ToString

string ToString()

TryGet

bool TryGet(int index, out TProxy value)

bool TryGet(Index index, out TProxy value)