WebMessageEncodingElement.WriteEncoding Property
.NET Framework 4.5
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.EncodingA 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);
}
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.