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);  
}  

适用于