共用方式為


MsmqIntegrationBinding.SerializationFormat 屬性

定義

取得或設定要用於序列化或還原序列化訊息的序列化格式。

public:
 property System::ServiceModel::MsmqIntegration::MsmqMessageSerializationFormat SerializationFormat { System::ServiceModel::MsmqIntegration::MsmqMessageSerializationFormat get(); void set(System::ServiceModel::MsmqIntegration::MsmqMessageSerializationFormat value); };
public System.ServiceModel.MsmqIntegration.MsmqMessageSerializationFormat SerializationFormat { get; set; }
member this.SerializationFormat : System.ServiceModel.MsmqIntegration.MsmqMessageSerializationFormat with get, set
Public Property SerializationFormat As MsmqMessageSerializationFormat

屬性值

MsmqMessageSerializationFormat 物件,表示要使用的序列化型別。

範例

下列程式碼說明如何在 MsmqIntegrationBinding 類別的執行個體上設定序列化格式:

// 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();

備註

這個屬性會傳回列舉值,指定 WCF 訊息的序列化和還原序列化方式。 如需詳細資訊,請參閱MsmqMessageSerializationFormat

適用於