Compartir a través de


WebClient.Encoding Property

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

Gets and sets the Encoding used to upload and download strings.

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

Syntax

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

Property Value

Type: System.Text.Encoding
A Encoding that is used to encode strings. The default value of this property is UTF8.

Exceptions

Exception Condition
ArgumentNullException

A nulla null reference (Nothing in Visual Basic) value was passed to set this property.

Remarks

The UploadStringAsync methods use this property to convert the specified string to a Byte array before uploading the string. For additional information, see the GetBytes method.

When a string is downloaded using the DownloadStringAsync methods, WebClient uses the Encoding returned by this to convert the downloaded Byte array into a string. For additional information, see the GetString method.

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.