Class AmqpSerializer
Serializes and deserializes an instance of an AMQP type. The descriptor (name and code) is scoped to and must be unique within an instance of the serializer. When the static Serialize and Deserialize methods are called, the default instance is used.
Inheritance
Inherited Members
Namespace: Amqp.Serialization
Assembly: Amqp.Net.dll
Syntax
public sealed class AmqpSerializer
Constructors
AmqpSerializer()
Initializes a new instance of the AmqpSerializer class with the default contract resolver that supports custom classes decorated with AmqpContractAttribute and AmqpMemberAttribute.
Declaration
public AmqpSerializer()
AmqpSerializer(IContractResolver)
Initializes a new instance of the AmqpSerializer class with a custom contract resolver. See documentation for the order followed by the serializer to resolve a type.
Declaration
public AmqpSerializer(IContractResolver contractResolver)
Parameters
| Type | Name | Description |
|---|---|---|
| IContractResolver | contractResolver | A contract resolver to create a serialization contract for a given type. |
Methods
Deserialize<T>(ByteBuffer)
Deserializes an instance of an AMQP type from a buffer.
Declaration
public static T Deserialize<T>(ByteBuffer buffer)
Parameters
| Type | Name | Description |
|---|---|---|
| ByteBuffer | buffer | The buffer to read from. |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T | The serializable type. |
Deserialize<T, TAs>(ByteBuffer)
Deserializes an instance of an AMQP type from a buffer.
Declaration
public static TAs Deserialize<T, TAs>(ByteBuffer buffer)
Parameters
| Type | Name | Description |
|---|---|---|
| ByteBuffer | buffer | The buffer to read from. |
Returns
| Type | Description |
|---|---|
| TAs |
Type Parameters
| Name | Description |
|---|---|
| T | The serializable type. |
| TAs | The return type of the deserialized object. |
ReadObject<T>(ByteBuffer)
Reads an serializable object from a buffer.
Declaration
public T ReadObject<T>(ByteBuffer buffer)
Parameters
| Type | Name | Description |
|---|---|---|
| ByteBuffer | buffer | The buffer to read. |
Returns
| Type | Description |
|---|---|
| T |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the serializable object. |
ReadObject<T, TAs>(ByteBuffer)
Reads an serializable object from a buffer.
Declaration
public TAs ReadObject<T, TAs>(ByteBuffer buffer)
Parameters
| Type | Name | Description |
|---|---|---|
| ByteBuffer | buffer | The buffer to read. |
Returns
| Type | Description |
|---|---|
| TAs |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the serializable object. |
| TAs | The return type of the deserialized object. |
Serialize(ByteBuffer, Object)
Serializes an instance of an AMQP type into a buffer.
Declaration
public static void Serialize(ByteBuffer buffer, object graph)
Parameters
| Type | Name | Description |
|---|---|---|
| ByteBuffer | buffer | The buffer. |
| System.Object | graph | The serializable AMQP object. |
WriteObject(ByteBuffer, Object)
Writes an serializable object into a buffer.
Declaration
public void WriteObject(ByteBuffer buffer, object graph)
Parameters
| Type | Name | Description |
|---|---|---|
| ByteBuffer | buffer | The buffer to write. |
| System.Object | graph | The serializable object. |