Struct SerializedPrimitiveView
A view on top of the PackedBinaryStream that represents any unquoted value.
Namespace: Unity.Serialization.Json
Syntax
public struct SerializedPrimitiveView : ISerializedView
Methods
AsBoolean()
Reinterprets the primitive as a bool.
Declaration
public 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 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 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 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 string AsString()
Returns
Type | Description |
---|---|
String | A String copy of the primitive. |
AsStringView()
Returns a string view over the primitive.
Declaration
public SerializedStringView AsStringView()
Returns
Type | Description |
---|---|
SerializedStringView | A SerializedStringView over this primitive. |
AsUInt64()
Reinterprets the primitive as a ulong.
Declaration
public 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 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 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 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 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 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 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 bool IsSigned()
Returns
Type | Description |
---|---|
Boolean | True if this primitive is an signed type; false otherwise. |