Class Encoder
Convenience method for serializing and deserializing arbitrary objects to json or msgpack.
Inheritance
System.Object
Encoder
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Algorand
Assembly: Algorand.dll
Syntax
public class Encoder
Methods
| Improve this Doc View SourceDecodeFromJson<T>(String)
Decode a json string to an object.
Declaration
public static T DecodeFromJson<T>(string json)
Parameters
Type | Name | Description |
---|---|---|
System.String | json | json string |
Returns
Type | Description |
---|---|
T | object |
Type Parameters
Name | Description |
---|---|
T | object type |
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 |
---|---|---|
System.Byte[] | input | input byte array representing canonical msg-pack encoding |
Returns
Type | Description |
---|---|
T | deserialized object |
Type Parameters
Name | Description |
---|---|
T | object type |
EncodeToHexStr(Byte[])
Convenience method for writing bytes as hex.
Declaration
public static string EncodeToHexStr(byte[] bytes)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | bytes | bytes input to encodeToMsgPack as hex string |
Returns
Type | Description |
---|---|
System.String | encoded hex string |
EncodeToJson(Object)
Encode an object as json.
Declaration
public static string EncodeToJson(object o)
Parameters
Type | Name | Description |
---|---|---|
System.Object | o | object to encode |
Returns
Type | Description |
---|---|
System.String | json string |
EncodeToMsgPack(Object)
Convenience method for serializing arbitrary objects.
Declaration
public static byte[] EncodeToMsgPack(object o)
Parameters
Type | Name | Description |
---|---|---|
System.Object | o | the object to serializing |
Returns
Type | Description |
---|---|
System.Byte[] | serialized object |