JsonReadOnlyProxyArray<TValue>

Namespace: SnowBank.Data.Json · struct

Implements: IReadOnlyList<TValue>, IEnumerable<TValue>, IEnumerable, IReadOnlyCollection<TValue>, IJsonSerializable, IJsonPackable, IEquatable<ObservableJsonValue>, IEquatable<JsonValue>, IEquatable<JsonReadOnlyProxyArray<TValue>>

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

Constructors

JsonReadOnlyProxyArray<TValue>

JsonReadOnlyProxyArray<TValue>(ObservableJsonValue value, IJsonConverter<TValue> converter = null)

Properties

Count

int Count { get; }

Item

TValue Item { get; }

TValue Item { get; }

Methods

Equals

bool Equals(object obj)

bool Equals(ObservableJsonValue other)

bool Equals(JsonValue other)

bool Equals(JsonReadOnlyProxyArray<TValue> other)

Exists

bool Exists()

Tests if the array is present.

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

Get

TValue Get(int index)

TValue Get(Index index)

GetEnumerator

IEnumerator<TValue> GetEnumerator()

GetHashCode

int GetHashCode()

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...

ToArray

TValue[] ToArray()

ToJsonValue

JsonValue ToJsonValue()

ToList

List<TValue> ToList()

ToString

string ToString()

TryGet

bool TryGet(int index, out TValue value)

bool TryGet(Index index, out TValue value)