Share via


IContextManager.SetContext(IDictionary<String,String>) 方法

定义

设置上下文。

public:
 void SetContext(System::Collections::Generic::IDictionary<System::String ^, System::String ^> ^ context);
public void SetContext (System.Collections.Generic.IDictionary<string,string> context);
abstract member SetContext : System.Collections.Generic.IDictionary<string, string> -> unit
Public Sub SetContext (context As IDictionary(Of String, String))

参数

context
IDictionary<String,String>

键/值对的 IDictionary<TKey,TValue>,包含已设置的上下文命名空间和名称。

示例

下面的代码演示如何在客户端上设置上下文。

IDictionary<string, string> context;  
CalculatorProxy proxy;  
IContextManager cm = proxy.InnerChannel.GetProperty<IContextManager>();  
if (cm != null)  
    cm.SetContext(context);  

适用于