ContextInformation.HostingContext 属性

定义

获取正在计算配置属性的环境的上下文。

public:
 property System::Object ^ HostingContext { System::Object ^ get(); };
public object HostingContext { get; }
member this.HostingContext : obj
Public ReadOnly Property HostingContext As Object

属性值

一个对象,指定正在计算配置属性的环境。

示例

下面的代码示例演示如何使用 HostingContext 属性。

// Create an object based on HostingContext.
WebContext myWC =
  (WebContext)config.EvaluationContext.HostingContext;
// Use the WebContext object to determine
// the ApplicationLevel.
Console.WriteLine("ApplicationLevel: {0}",
  myWC.ApplicationLevel);
' Create an object based on HostingContext.
Dim myWC As WebContext = _
  config.EvaluationContext.HostingContext
' Use the WebContext object to determine
' the ApplicationLevel.
Console.WriteLine("ApplicationLevel: {0}", _
  myWC.ApplicationLevel)

注解

可能的 HostingContext 值为 WebContextExeContextnull

适用于

另请参阅