다음을 통해 공유


BasicHttpBinding.TextEncoding Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the character encoding that is used for the message text.

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

Syntax

'Declaration
Public Property TextEncoding As Encoding
public Encoding TextEncoding { get; set; }

Property Value

Type: System.Text.Encoding
The Encoding that indicates the character encoding that is used. The default is UTF8Encoding.

Examples

            'Gets the character encoding for the binding
            Dim encoding As Encoding = binding.TextEncoding
            'Output txtEncoding: System.Text.UTF8Encoding
            Dim txtEncoding As String = encoding.ToString()
            Dim unicodeEncoding As Encoding = New UnicodeEncoding()
            'Set a Unicode encoding for the binding
            binding.TextEncoding = unicodeEncoding
            'Output txtEncoding: System.Text.UnicodeEncoding
            Dim txtUEncoding As String = binding.TextEncoding.ToString()

            //Gets the character encoding for the binding
            Encoding encoding = binding.TextEncoding;
            //Output txtEncoding: System.Text.UTF8Encoding
            string txtEncoding = encoding.ToString();
            Encoding unicodeEncoding = new UnicodeEncoding();
            //Set a Unicode encoding for the binding
            binding.TextEncoding = unicodeEncoding;
            //Output txtEncoding: System.Text.UnicodeEncoding
            string txtUEncoding = binding.TextEncoding.ToString();

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.