WebMessageEncodingElement.WriteEncoding Property

 

Gets or sets the character set encoding to be used for emitting messages on the binding.

Namespace:   System.ServiceModel.Configuration
Assembly:  System.ServiceModel.Web (in System.ServiceModel.Web.dll)

[ConfigurationPropertyAttribute("writeEncoding", DefaultValue = "utf-8")]
public Encoding WriteEncoding { get; set; }

Property Value

Type: System.Text.Encoding

A valid Encoding value that specifies the character set encoding to be used for emitting messages on the binding. The default is UTF8Encoding.

Exception Condition
ArgumentNullException

The value set is 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);
}

.NET Framework
Available since 3.5
Return to top
Show: