共用方式為


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>

適用於