HttpClientChannel 建構函式
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
初始化 HttpClientChannel 類別的新執行個體。
多載
| 名稱 | Description |
|---|---|
| HttpClientChannel() |
初始化 HttpClientChannel 類別的新執行個體。 |
| HttpClientChannel(IDictionary, IClientChannelSinkProvider) |
初始化一個新的類別實例 HttpClientChannel ,並具備指定的組態屬性與 sink。 |
| HttpClientChannel(String, IClientChannelSinkProvider) |
初始化一個以指定名稱和 sink 的新 HttpClientChannel 類別實例。 |
HttpClientChannel()
初始化 HttpClientChannel 類別的新執行個體。
public:
HttpClientChannel();
public HttpClientChannel();
Public Sub New ()
備註
這個建構子回傳的實例的設定屬性 HttpClientChannel 都設定為預設值。
適用於
HttpClientChannel(IDictionary, IClientChannelSinkProvider)
初始化一個新的類別實例 HttpClientChannel ,並具備指定的組態屬性與 sink。
public:
HttpClientChannel(System::Collections::IDictionary ^ properties, System::Runtime::Remoting::Channels::IClientChannelSinkProvider ^ sinkProvider);
public HttpClientChannel(System.Collections.IDictionary properties, System.Runtime.Remoting.Channels.IClientChannelSinkProvider sinkProvider);
new System.Runtime.Remoting.Channels.Http.HttpClientChannel : System.Collections.IDictionary * System.Runtime.Remoting.Channels.IClientChannelSinkProvider -> System.Runtime.Remoting.Channels.Http.HttpClientChannel
Public Sub New (properties As IDictionary, sinkProvider As IClientChannelSinkProvider)
參數
- properties
- IDictionary
一個 IDictionary 集合,指定通道將使用的配置屬性值。
- sinkProvider
- IClientChannelSinkProvider
IClientChannelSinkProvider頻道將使用的實作。
例外狀況
一個設定屬性格式錯誤。
範例
以下程式碼範例說明如何使用此建構子。
// Create a client channel.
System::Collections::Hashtable^ properties = gcnew System::Collections::Hashtable;
properties->default[ L"port" ] = 9090;
IClientChannelSinkProvider^ sinkProvider = nullptr;
HttpClientChannel^ clientChannel = gcnew HttpClientChannel( properties,sinkProvider );
// Create a client channel.
System.Collections.Hashtable properties =
new System.Collections.Hashtable();
properties["port"] = 9090;
IClientChannelSinkProvider sinkProvider = null;
HttpClientChannel clientChannel = new HttpClientChannel(
properties, sinkProvider);
備註
欲了解更多通道配置屬性,請參閱 通道與形式配置屬性。
如果你不需要匯入功能,請將參數設 sinkProvider 為 null。
另請參閱
適用於
HttpClientChannel(String, IClientChannelSinkProvider)
初始化一個以指定名稱和 sink 的新 HttpClientChannel 類別實例。
public:
HttpClientChannel(System::String ^ name, System::Runtime::Remoting::Channels::IClientChannelSinkProvider ^ sinkProvider);
public HttpClientChannel(string name, System.Runtime.Remoting.Channels.IClientChannelSinkProvider sinkProvider);
new System.Runtime.Remoting.Channels.Http.HttpClientChannel : string * System.Runtime.Remoting.Channels.IClientChannelSinkProvider -> System.Runtime.Remoting.Channels.Http.HttpClientChannel
Public Sub New (name As String, sinkProvider As IClientChannelSinkProvider)
參數
- name
- String
新實例的名稱。HttpClientChannel
- sinkProvider
- IClientChannelSinkProvider
頻道 IClientChannelSinkProvider 會使用。
範例
以下程式碼範例說明如何使用此建構子。
// Create a client channel.
String^ name = L"RemotingClient";
IClientChannelSinkProvider^ sinkProvider = nullptr;
HttpClientChannel^ clientChannel = gcnew HttpClientChannel( name,sinkProvider );
// Create a client channel.
string name = "RemotingClient";
IClientChannelSinkProvider sinkProvider = null;
HttpClientChannel clientChannel = new HttpClientChannel(name,
sinkProvider);
備註
此建構子利用參數name設定該ChannelName性質。