10.29.00

MessageSerializationExtensionsSerializeT Method

The IMessage.Serailize extension method. Serializes the data into the message with ISerializer. Note this may modify the IMessage binary attachment and user properties. Note the user properties will be reset for field iteration. So Rewind is called.

Definition

Namespace: SolaceSystems.Solclient.Messaging.Serialization
Assembly: SolaceSystems.Solclient.Messaging (in SolaceSystems.Solclient.Messaging.dll) Version: 10.29.0
C#
public static void Serialize<T>(
	this IMessage msg,
	ISerializer<T> serializer,
	T data,
	IDestination destination = null
)

Parameters

msg  IMessage
IMessage to serialize data into
serializer  ISerializerT
ISerializer to convert data. Passing unsupported header value data types will result in SerializationException being thrown. Check logs for details. The list of header value data types supported for serialization:
  • string
  • bool
  • null
  • byte[]
  • byte
  • sbyte
  • ushort
  • short
  • uint
  • int
  • ulong
  • long
  • char
  • float
  • double
data  T
The data object to serialize
destination  IDestination  (Optional)
optional destination provided to serializer, uses IMessage.Destination if null.

Type Parameters

T
type of data to serialize

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IMessage. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions

SerializationExceptionWhen serializer fails to serialize data.

See Also