共用方式為


WebMessageEncodingElement.WriteEncoding 屬性

定義

取得或設定要在繫結上發出訊息時使用的字元集編碼方式。

public:
 property System::Text::Encoding ^ WriteEncoding { System::Text::Encoding ^ get(); void set(System::Text::Encoding ^ value); };
[System.ComponentModel.TypeConverter(typeof(System.ServiceModel.Configuration.EncodingConverter))]
[System.Configuration.ConfigurationProperty("writeEncoding", DefaultValue="utf-8")]
public System.Text.Encoding WriteEncoding { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.ServiceModel.Configuration.EncodingConverter))>]
[<System.Configuration.ConfigurationProperty("writeEncoding", DefaultValue="utf-8")>]
member this.WriteEncoding : System.Text.Encoding with get, set
Public Property WriteEncoding As Encoding

屬性值

Encoding

有效的 Encoding 值,指定要在繫結上發出訊息時使用的字元集編碼方式。 預設為 UTF8Encoding

屬性

例外狀況

設定的值為 null

範例

using System;  
using System.Text;  
using System.ServiceModel;  
using System.ServiceModel.Web;  
using System.ServiceModel.Configuration;  

static void Main()  
{  
    Encoding webMessageEncoding = webMEE.WriteEncoding;  
    Console.WriteLine("The write encoding is: {0}",     webMessageEncoding);  
    webMessageEncoding = UnicodeEncoding.Unicode;  
    Console.WriteLine("The write encoding has been changed to: {0}", webMessageEncoding);  
}  

適用於