Struct SerializedObjectView
A view on top of the PackedBinaryStream that represents a set of key-values.
Inherited Members
Namespace: Unity.Serialization.Json
Syntax
public readonly struct SerializedObjectView : ISerializedView, IEnumerable<SerializedMemberView>, IEnumerable
Properties
Item[String]
Gets the value associated with the specified key.
Declaration
public readonly SerializedValueView this[string name] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | The key of the value to get. |
Property Value
| Type | Description |
|---|---|
| SerializedValueView |
Exceptions
| Type | Condition |
|---|---|
| KeyNotFoundException | The key does not exist in the collection. |
Item[in FixedString128Bytes]
Gets the value associated with the specified key.
Declaration
public readonly SerializedValueView this[in FixedString128Bytes name] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| FixedString128Bytes | name | The key of the value to get. |
Property Value
| Type | Description |
|---|---|
| SerializedValueView |
Exceptions
| Type | Condition |
|---|---|
| KeyNotFoundException | The key does not exist in the collection. |
Item[in FixedString32Bytes]
Gets the value associated with the specified key.
Declaration
public readonly SerializedValueView this[in FixedString32Bytes name] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| FixedString32Bytes | name | The key of the value to get. |
Property Value
| Type | Description |
|---|---|
| SerializedValueView |
Exceptions
| Type | Condition |
|---|---|
| KeyNotFoundException | The key does not exist in the collection. |
Item[in FixedString64Bytes]
Gets the value associated with the specified key.
Declaration
public readonly SerializedValueView this[in FixedString64Bytes name] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| FixedString64Bytes | name | The key of the value to get. |
Property Value
| Type | Description |
|---|---|
| SerializedValueView |
Exceptions
| Type | Condition |
|---|---|
| KeyNotFoundException | The key does not exist in the collection. |
Methods
GetEnumerator()
Returns an enumerator that iterates through the SerializedObjectView.
Declaration
public readonly SerializedObjectView.Enumerator GetEnumerator()
Returns
| Type | Description |
|---|---|
| SerializedObjectView.Enumerator | A SerializedObjectView.Enumerator for the SerializedObjectView. |
GetMember(String)
Gets the member associated with the specified key.
Declaration
public readonly SerializedMemberView GetMember(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | The key of the member to get. |
Returns
| Type | Description |
|---|---|
| SerializedMemberView | Returns the member associated with the specified key. |
GetMember<T>(in T)
Gets the member associated with the specified key.
Declaration
public readonly SerializedMemberView GetMember<T>(in T name)
where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
| Type | Name | Description |
|---|---|---|
| T | name | The key of the member to get. |
Returns
| Type | Description |
|---|---|
| SerializedMemberView | Returns the member associated with the specified key. |
Type Parameters
| Name | Description |
|---|---|
| T | The fixed string type. |
GetValue(String)
Gets the value associated with the specified key.
Declaration
public readonly SerializedValueView GetValue(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | The key of the value to get. |
Returns
| Type | Description |
|---|---|
| SerializedValueView | Returns the value associated with the specified key. |
GetValue<T>(in T)
Gets the value associated with the specified key.
Declaration
public readonly SerializedValueView GetValue<T>(in T name)
where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
| Type | Name | Description |
|---|---|---|
| T | name | The key of the value to get. |
Returns
| Type | Description |
|---|---|
| SerializedValueView | Returns the value associated with the specified key. |
Type Parameters
| Name | Description |
|---|---|
| T | The fixed string type. |
TryGetMember(String, out SerializedMemberView)
Gets the member associated with the specified key.
Declaration
public readonly bool TryGetMember(string name, out SerializedMemberView member)
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | The key of the member to get. |
| SerializedMemberView | member | When this method returns, contains the member associated with the specified key, if the key is found; otherwise, the default value. |
Returns
| Type | Description |
|---|---|
| Boolean | true if the SerializedObjectView contains an element with the specified key; otherwise, false. |
TryGetMember<T>(in T, out SerializedMemberView)
Gets the member associated with the specified key.
Declaration
public readonly bool TryGetMember<T>(in T name, out SerializedMemberView member)
where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
| Type | Name | Description |
|---|---|---|
| T | name | The key of the member to get. |
| SerializedMemberView | member | When this method returns, contains the member associated with the specified key, if the key is found; otherwise, the default value. |
Returns
| Type | Description |
|---|---|
| Boolean | true if the SerializedObjectView contains an element with the specified key; otherwise, false. |
Type Parameters
| Name | Description |
|---|---|
| T | The fixed string type. |
TryGetValue(String, out SerializedValueView)
Gets the value associated with the specified key.
Declaration
public readonly bool TryGetValue(string name, out SerializedValueView value)
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | The key of the value to get. |
| SerializedValueView | value | When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value. |
Returns
| Type | Description |
|---|---|
| Boolean | true if the SerializedObjectView contains an element with the specified key; otherwise, false. |
TryGetValue<T>(in T, out SerializedValueView)
Gets the value associated with the specified key.
Declaration
public readonly bool TryGetValue<T>(in T name, out SerializedValueView value)
where T : struct, INativeList<byte>, IUTF8Bytes
Parameters
| Type | Name | Description |
|---|---|---|
| T | name | The key of the value to get. |
| SerializedValueView | value | When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value. |
Returns
| Type | Description |
|---|---|
| Boolean | true if the SerializedObjectView contains an element with the specified key; otherwise, false. |
Type Parameters
| Name | Description |
|---|---|
| T | The fixed string type. |
TryGetValueAsBoolean(String, out Boolean)
Gets the value associated with the specified key as a Boolean.
Declaration
public readonly bool TryGetValueAsBoolean(string name, out bool value)
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | The key of the value to get. |
| Boolean | value | When this method returns, contains the value associated with the specified key and type, if the key is found and the type matches; otherwise, the default value. |
Returns
| Type | Description |
|---|---|
| Boolean | true if the SerializedObjectView contains an element with the specified key and type; otherwise, false. |
TryGetValueAsDouble(String, out Double)
Gets the value associated with the specified key as a Double.
Declaration
public readonly bool TryGetValueAsDouble(string name, out double value)
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | The key of the value to get. |
| Double | value | When this method returns, contains the value associated with the specified key and type, if the key is found and the type matches; otherwise, the default value. |
Returns
| Type | Description |
|---|---|
| Boolean | true if the SerializedObjectView contains an element with the specified key and type; otherwise, false. |
TryGetValueAsFloat(String, out Single)
Gets the value associated with the specified key as a Single.
Declaration
public readonly bool TryGetValueAsFloat(string name, out float value)
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | The key of the value to get. |
| Single | value | When this method returns, contains the value associated with the specified key and type, if the key is found and the type matches; otherwise, the default value. |
Returns
| Type | Description |
|---|---|
| Boolean | true if the SerializedObjectView contains an element with the specified key and type; otherwise, false. |
TryGetValueAsInt64(String, out Int64)
Gets the value associated with the specified key as a Int64.
Declaration
public readonly bool TryGetValueAsInt64(string name, out long value)
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | The key of the value to get. |
| Int64 | value | When this method returns, contains the value associated with the specified key and type, if the key is found and the type matches; otherwise, the default value. |
Returns
| Type | Description |
|---|---|
| Boolean | true if the SerializedObjectView contains an element with the specified key and type; otherwise, false. |
TryGetValueAsString(String, out String)
Gets the value associated with the specified key as a String.
Declaration
public readonly bool TryGetValueAsString(string name, out string value)
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | The key of the value to get. |
| String | value | When this method returns, contains the value associated with the specified key and type, if the key is found and the type matches; otherwise, the default value. |
Returns
| Type | Description |
|---|---|
| Boolean | true if the SerializedObjectView contains an element with the specified key and type; otherwise, false. |
TryGetValueAsUInt64(String, out UInt64)
Gets the value associated with the specified key as a UInt64.
Declaration
public readonly bool TryGetValueAsUInt64(string name, out ulong value)
Parameters
| Type | Name | Description |
|---|---|---|
| String | name | The key of the value to get. |
| UInt64 | value | When this method returns, contains the value associated with the specified key and type, if the key is found and the type matches; otherwise, the default value. |
Returns
| Type | Description |
|---|---|
| Boolean | true if the SerializedObjectView contains an element with the specified key and type; otherwise, false. |
Operators
Implicit(SerializedObjectView to SerializedValueView)
Re-interprets the specified object view to an untyped value view.
Declaration
public static implicit operator SerializedValueView(SerializedObjectView view)
Parameters
| Type | Name | Description |
|---|---|---|
| SerializedObjectView | view | The object view to re-interpret. |
Returns
| Type | Description |
|---|---|
| SerializedValueView | The untyped value view for the given object. |
Explicit Interface Implementations
IEnumerable<SerializedMemberView>.GetEnumerator()
Returns an enumerator that iterates through the SerializedObjectView.
Declaration
readonly IEnumerator<SerializedMemberView> IEnumerable<SerializedMemberView>.GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator<SerializedMemberView> | A SerializedObjectView.Enumerator for the SerializedObjectView. |
Implements
IEnumerable.GetEnumerator()
Returns an enumerator that iterates through the SerializedObjectView.
Declaration
readonly IEnumerator IEnumerable.GetEnumerator()
Returns
| Type | Description |
|---|---|
| IEnumerator | A SerializedObjectView.Enumerator for the SerializedObjectView. |