BasicHttpBinding.TextEncoding 属性

定义

获取或设置用于消息文本的字符编码。

public:
 property System::Text::Encoding ^ TextEncoding { System::Text::Encoding ^ get(); void set(System::Text::Encoding ^ value); };
public System.Text.Encoding TextEncoding { get; set; }
[System.ComponentModel.TypeConverter(typeof(System.ServiceModel.Configuration.EncodingConverter))]
public System.Text.Encoding TextEncoding { get; set; }
member this.TextEncoding : System.Text.Encoding with get, set
[<System.ComponentModel.TypeConverter(typeof(System.ServiceModel.Configuration.EncodingConverter))>]
member this.TextEncoding : System.Text.Encoding with get, set
Public Property TextEncoding As Encoding

属性值

Encoding

用于指示所使用的字符编码的 Encoding。 默认值为 UTF8Encoding

属性

示例

以下示例将 TextEncoding 设置为 Encoding.Unicode.

BasicHttpBinding binding = new BasicHttpBinding();
binding.TextEncoding = System.Text.Encoding.Unicode;

也可以在配置文件中设置此属性的值。

<configuration>
  <system.serviceModel>

    <bindings>
      <basicHttpBinding>
        <binding name="Binding1"
          textEncoding = "UnicodeFffeTextEncoding">

          <security mode="None" />
        </binding>
      </basicHttpBinding>
    </bindings>
  </system.serviceModel>

</configuration>

适用于