Struct SerializedPrimitiveView
A view on top of the PackedBinaryStream that represents any unquoted value.
Inherited Members
Namespace: Unity.Serialization.Json
Syntax
public readonly struct SerializedPrimitiveView : ISerializedView
Methods
AsBoolean()
Reinterprets the primitive as a bool.
Declaration
public readonly bool AsBoolean()
Returns
Type | Description |
---|---|
Boolean | The primitive as a bool. |
Exceptions
Type | Condition |
---|---|
ParseErrorException | The parser failed to convert the characters. |
AsDouble()
Reinterprets the primitive as a double.
Declaration
public readonly double AsDouble()
Returns
Type | Description |
---|---|
Double | The primitive as a double. |
Remarks
This method relies on a string allocation for Parse(String).
AsFloat()
Reinterprets the primitive as a float.
Declaration
public readonly float AsFloat()
Returns
Type | Description |
---|---|
Single | The primitive as a float. |
Exceptions
Type | Condition |
---|---|
ParseErrorException | The parser failed to convert the characters. |
AsInt64()
Reinterprets the primitive as a long.
Declaration
public readonly long AsInt64()
Returns
Type | Description |
---|---|
Int64 | The primitive as a long. |
Exceptions
Type | Condition |
---|---|
ParseErrorException | The parser failed to convert the characters. |
AsString()
Allocates and returns a new String for the primitive.
Declaration
public readonly string AsString()
Returns
Type | Description |
---|---|
String | A String copy of the primitive. |
AsStringView()
Returns a string view over the primitive.
Declaration
public readonly SerializedStringView AsStringView()
Returns
Type | Description |
---|---|
SerializedStringView | A SerializedStringView over this primitive. |
AsUInt64()
Reinterprets the primitive as a ulong.
Declaration
public readonly ulong AsUInt64()
Returns
Type | Description |
---|---|
UInt64 | The primitive as a ulong. |
Exceptions
Type | Condition |
---|---|
ParseErrorException | The parser failed to convert the characters. |
IsBoolean()
Returns true if the primitive is a boolean type.
Declaration
public readonly bool IsBoolean()
Returns
Type | Description |
---|---|
Boolean | True if this primitive is an boolean type; false otherwise. |
IsDecimal()
Returns true if the primitive is a decimal type.
Declaration
public readonly bool IsDecimal()
Returns
Type | Description |
---|---|
Boolean | True if this primitive is an decimal type; false otherwise. |
IsInfinity()
Returns true if the primitive represents infinity.
Declaration
public readonly bool IsInfinity()
Returns
Type | Description |
---|---|
Boolean | True if this primitive is infinity; false otherwise. |
IsIntegral()
Returns true if the primitive is an integral type.
Declaration
public readonly bool IsIntegral()
Returns
Type | Description |
---|---|
Boolean | True if this primitive is an integral type; false otherwise. |
IsNaN()
Returns true if the primitive represents a value that is not a number.
Declaration
public readonly bool IsNaN()
Returns
Type | Description |
---|---|
Boolean | True if this primitive is nan; false otherwise. |
IsNull()
Returns true if the primitive represents a value that is null.
Declaration
public readonly bool IsNull()
Returns
Type | Description |
---|---|
Boolean | True if this primitive is null; false otherwise. |
IsSigned()
Returns true if the primitive is a signed type.
Declaration
public readonly bool IsSigned()
Returns
Type | Description |
---|---|
Boolean | True if this primitive is an signed type; false otherwise. |