Class Encoder
Convenience class for serializing and deserializing arbitrary objects to json or msgpack.
Assembly: Algorand.dll
Syntax
public static class Encoder
Fields
|
Edit this page
View Source
EncodeToMsgPack
Declaration
public static bool EncodeToMsgPack
Field Value
Methods
|
Edit this page
View Source
DecodeFromJson<T>(string)
Decode a json string to an object.
Declaration
public static T DecodeFromJson<T>(string json)
Parameters
| Type |
Name |
Description |
| string |
json |
json string
|
Returns
| Type |
Description |
| T |
object
|
Type Parameters
| Name |
Description |
| T |
object type
|
|
Edit this page
View Source
DecodeFromMsgPack<T>(byte[])
Convenience method for deserializing arbitrary objects encoded with canonical msg-pack
Declaration
public static T DecodeFromMsgPack<T>(byte[] input)
Parameters
| Type |
Name |
Description |
| byte[] |
input |
input byte array representing canonical msg-pack encoding
|
Returns
| Type |
Description |
| T |
deserialized object
|
Type Parameters
| Name |
Description |
| T |
object type
|
|
Edit this page
View Source
DeltaValueBytesToString(byte[])
Declaration
public static string DeltaValueBytesToString(byte[] data)
Parameters
| Type |
Name |
Description |
| byte[] |
data |
|
Returns
|
Edit this page
View Source
DeltaValueStringToBytes(string)
Declaration
public static byte[] DeltaValueStringToBytes(string data)
Parameters
| Type |
Name |
Description |
| string |
data |
|
Returns
|
Edit this page
View Source
EncodeToHexStr(byte[])
Convenience method for writing bytes as hex.
Declaration
public static string EncodeToHexStr(byte[] bytes)
Parameters
| Type |
Name |
Description |
| byte[] |
bytes |
bytes input to encodeToMsgPack as hex string
|
Returns
| Type |
Description |
| string |
encoded hex string
|
|
Edit this page
View Source
EncodeToJson(object)
Encode an object as json.
Declaration
public static string EncodeToJson(object o)
Parameters
| Type |
Name |
Description |
| object |
o |
object to encode
|
Returns
| Type |
Description |
| string |
json string
|
|
Edit this page
View Source
EncodeToMsgPackNoOrder(object)
Declaration
public static byte[] EncodeToMsgPackNoOrder(object o)
Parameters
| Type |
Name |
Description |
| object |
o |
|
Returns
|
Edit this page
View Source
EncodeToMsgPackOrdered(List<SignedTransaction>)
Convenience method for serializing lists without the list wrapper: just concat each serialised object
Declaration
public static byte[] EncodeToMsgPackOrdered(List<SignedTransaction> o)
Parameters
Returns
| Type |
Description |
| byte[] |
serialized object
|
|
Edit this page
View Source
EncodeToMsgPackOrdered(object)
Convenience method for serializing arbitrary objects.
Declaration
public static byte[] EncodeToMsgPackOrdered(object o)
Parameters
| Type |
Name |
Description |
| object |
o |
the object to serializing
|
Returns
| Type |
Description |
| byte[] |
serialized object
|
|
Edit this page
View Source
FromBigEndianBytes(byte[])
Big endian conversion for ulong value from 8 bytes.
Declaration
public static ulong FromBigEndianBytes(this byte[] bytes)
Parameters
| Type |
Name |
Description |
| byte[] |
bytes |
|
Returns
Exceptions
|
Edit this page
View Source
HexStringToByteArray(string)
Declaration
public static byte[] HexStringToByteArray(string hex)
Parameters
| Type |
Name |
Description |
| string |
hex |
|
Returns
|
Edit this page
View Source
ToBigEndianBytes(ulong)
Convenience method to get a value as a big-endian byte array
Declaration
public static byte[] ToBigEndianBytes(this ulong val)
Parameters
| Type |
Name |
Description |
| ulong |
val |
|
Returns
|
Edit this page
View Source
UInt256ToUlong(byte[])
Declaration
public static ulong UInt256ToUlong(byte[] bytes)
Parameters
| Type |
Name |
Description |
| byte[] |
bytes |
|
Returns