HttpApplicationState.StaticObjects 属性

定义

获取由 <object> 标记声明的所有对象,其中范围设置为 ASP.NET 应用程序中的“Application”。Gets all objects declared by an <object> tag where the scope is set to "Application" within the 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

属性值

页上的对象集合。A collection of objects on the page.

示例

下面的示例将所有应用程序对象获取HttpStaticObjectsCollection到变量中, 仅当对象数大于0时才执行例程。The following example gets all application objects into a HttpStaticObjectsCollection variable and executes a routine only if the number of objects is greater than 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 文件中定义的。Application objects are defined in the Global.asax file inside the <object runat="server" scope="Application"> </object> tags.

适用于