WebOperationContext.Current 属性

定义

获取当前 Web 操作的上下文。

public:
 static property System::ServiceModel::Web::WebOperationContext ^ Current { System::ServiceModel::Web::WebOperationContext ^ get(); };
public static System.ServiceModel.Web.WebOperationContext Current { get; }
static member Current : System.ServiceModel.Web.WebOperationContext
Public Shared ReadOnly Property Current As WebOperationContext

属性值

一个 WebOperationContext 实例。

示例

下面的代码演示如何访问当前 WebOperationContext 实例。

WebOperationContext current = WebOperationContext.Current;
WebHeaderCollection headers = current.IncomingRequest.Headers;

foreach (string name in headers)
{
    Console.WriteLine(name + " " + headers.Get(name));
}
Dim current As WebOperationContext = WebOperationContext.Current
Dim headers As WebHeaderCollection = current.IncomingRequest.Headers

For Each name As String In headers
    Console.WriteLine(name + " " + headers.Get(name))
Next

适用于