MsmqIntegrationBinding.SerializationFormat Property

Definition

Gets or sets the serialization format to be used to serialize or deserialize the message.

C#
public System.ServiceModel.MsmqIntegration.MsmqMessageSerializationFormat SerializationFormat { get; set; }

Property Value

A MsmqMessageSerializationFormat object that represents the type of serialization to use.

Examples

The following code illustrates how to set the serialization format on an instance of the MsmqIntegrationBinding class:

C#
// Create the purchase order.
PurchaseOrder po = new PurchaseOrder();
po.customerId = "somecustomer.com";
po.poNumber = Guid.NewGuid().ToString();

PurchaseOrderLineItem lineItem1 = new PurchaseOrderLineItem();
lineItem1.productId = "Blue Widget";
lineItem1.quantity = 54;
lineItem1.unitCost = 29.99F;

PurchaseOrderLineItem lineItem2 = new PurchaseOrderLineItem();
lineItem2.productId = "Red Widget";
lineItem2.quantity = 890;
lineItem2.unitCost = 45.89F;

po.orderLineItems = new PurchaseOrderLineItem[2];
po.orderLineItems[0] = lineItem1;
po.orderLineItems[1] = lineItem2;

OrderProcessorClient client = new OrderProcessorClient("OrderResponseEndpoint");
MsmqMessage<PurchaseOrder> ordermsg = new MsmqMessage<PurchaseOrder>(po);
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
{
    client.SubmitPurchaseOrder(ordermsg);
    scope.Complete();
}

Console.WriteLine("Order has been submitted:{0}", po);

//Closing the client gracefully closes the connection and cleans up resources.
client.Close();

Console.WriteLine();
Console.WriteLine("Press <ENTER> to terminate client.");
Console.ReadLine();

Remarks

This property returns an enumeration value that specifies how a WCF message will be serialized and deserialized. For more information, see MsmqMessageSerializationFormat.

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1