HttpApplicationState.StaticObjects 属性

定义

获取由 <object> 标记声明的所有对象,其中范围设置为 ASP.NET 应用程序中的“Application”。

public:
 property System::Web::HttpStaticObjectsCollection ^ StaticObjects { System::Web::HttpStaticObjectsCollection ^ get(); };
public System.Web.HttpStaticObjectsCollection StaticObjects { get; }
member this.StaticObjects : System.Web.HttpStaticObjectsCollection
Public ReadOnly Property StaticObjects As HttpStaticObjectsCollection

属性值

HttpStaticObjectsCollection

页上的对象集合。

示例

以下示例将所有应用程序对象获取到变量 HttpStaticObjectsCollection 中,并且仅在对象数大于 0 时才执行例程。

HttpStaticObjectsCollection PageObjects;

PageObjects = Application.StaticObjects;
if (PageObjects.Count > 0)
{
   //...
}
Dim PageObjects As HttpStaticObjectsCollection
 
PageObjects = Application.StaticObjects
If PageObjects.Count > 0 Then
   '...
End If

注解

应用程序对象在标记内的 <object runat="server" scope="Application"> </object> Global.asax 文件中定义。

适用于