HttpApplicationStateWrapper 类

定义

封装可用于在 ASP.NET 应用程序内多个请求和会话间共享信息的 HTTP 内部对象。Encapsulates the HTTP intrinsic object that enables information to be shared across multiple requests and sessions within an ASP.NET application.

public ref class HttpApplicationStateWrapper : System::Web::HttpApplicationStateBase
public class HttpApplicationStateWrapper : System.Web.HttpApplicationStateBase
type HttpApplicationStateWrapper = class
    inherit HttpApplicationStateBase
Public Class HttpApplicationStateWrapper
Inherits HttpApplicationStateBase
继承

注解

类派生自类, 用作HttpApplicationState类的包装。 HttpApplicationStateBase HttpApplicationStateWrapperThe HttpApplicationStateWrapper class derives from the HttpApplicationStateBase class and serves as a wrapper for the HttpApplicationState class. 此类公开HttpApplicationState类的功能, 同时HttpApplicationStateBase公开类型。This class exposes the functionality of the HttpApplicationState class while also exposing the HttpApplicationStateBase type. 通过类, 可以将应用程序中HttpApplicationState类的原始实现替换为自定义实现, 例如在 ASP.NET 管道之外执行单元测试时。 HttpApplicationStateBaseThe HttpApplicationStateBase class enables you to replace the original implementation of the HttpApplicationState class in your application with a custom implementation, such as when you perform unit testing outside the ASP.NET pipeline.

构造函数

HttpApplicationStateWrapper(HttpApplicationState)

初始化 HttpApplicationStateWrapper 类的新实例。Initializes a new instance of the HttpApplicationStateWrapper class.

属性

AllKeys

获取集合中对象的键。Gets the keys for the objects in the collection.

Contents

获取对 HttpApplicationStateBase 对象的引用。Gets a reference to the HttpApplicationStateBase object.

Count

获取集合中的对象数。Gets the number of objects in the collection.

IsReadOnly

获取或设置一个值,通过该值指示 NameObjectCollectionBase 实例是否为只读的。Gets or sets a value indicating whether the NameObjectCollectionBase instance is read-only.

(继承自 NameObjectCollectionBase)
IsSynchronized

获取一个值,该值指示对集合的访问是否是线程安全的。Gets a value that indicates whether access to the collection is thread-safe.

Item[Int32]

按索引获取状态对象。Gets a state object by index.

Item[String]

按名称获取状态对象。Gets a state object by name.

Keys

获取 NameObjectCollectionBase.KeysCollection 实例,该实例包含 HttpApplicationStateWrapper 实例中的所有键。Gets a NameObjectCollectionBase.KeysCollection instance that contains all the keys in the HttpApplicationStateWrapper instance.

StaticObjects

获取 object 元素声明的所有对象,其中范围设置为 ASP.NET 应用程序中的“Application”。Gets all objects that are declared by an object element where the scope is set to "Application" in the ASP.NET application.

SyncRoot

获取可用于同步对集合的访问的对象。Gets an object that can be used to synchronize access to the collection.

方法

Add(String, Object)

将对象添加到集合。Adds an object to the collection.

BaseAdd(String, Object)

将具有指定键和值的项添加到 NameObjectCollectionBase 实例中。Adds an entry with the specified key and value into the NameObjectCollectionBase instance.

(继承自 NameObjectCollectionBase)
BaseClear()

移除 NameObjectCollectionBase 实例中的所有项。Removes all entries from the NameObjectCollectionBase instance.

(继承自 NameObjectCollectionBase)
BaseGet(Int32)

获取 NameObjectCollectionBase 实例的指定索引处的项值。Gets the value of the entry at the specified index of the NameObjectCollectionBase instance.

(继承自 NameObjectCollectionBase)
BaseGet(String)

获取 NameObjectCollectionBase 实例中第一个具有指定键的项值。Gets the value of the first entry with the specified key from the NameObjectCollectionBase instance.

(继承自 NameObjectCollectionBase)
BaseGetAllKeys()

返回 String 数组,该数组包含 NameObjectCollectionBase 实例中的所有键。Returns a String array that contains all the keys in the NameObjectCollectionBase instance.

(继承自 NameObjectCollectionBase)
BaseGetAllValues()

返回 Object 数组,该数组包含 NameObjectCollectionBase 实例中的所有值。Returns an Object array that contains all the values in the NameObjectCollectionBase instance.

(继承自 NameObjectCollectionBase)
BaseGetAllValues(Type)

返回指定类型的数组,该数组包含 NameObjectCollectionBase 实例中的所有值。Returns an array of the specified type that contains all the values in the NameObjectCollectionBase instance.

(继承自 NameObjectCollectionBase)
BaseGetKey(Int32)

获取 NameObjectCollectionBase 实例的指定索引处的项键。Gets the key of the entry at the specified index of the NameObjectCollectionBase instance.

(继承自 NameObjectCollectionBase)
BaseHasKeys()

获取一个值,通过该值指示 NameObjectCollectionBase 实例是否包含键不为 null 的项。Gets a value indicating whether the NameObjectCollectionBase instance contains entries whose keys are not null.

(继承自 NameObjectCollectionBase)
BaseRemove(String)

移除 NameObjectCollectionBase 实例中具有指定键的项。Removes the entries with the specified key from the NameObjectCollectionBase instance.

(继承自 NameObjectCollectionBase)
BaseRemoveAt(Int32)

移除 NameObjectCollectionBase 实例的指定索引处的项。Removes the entry at the specified index of the NameObjectCollectionBase instance.

(继承自 NameObjectCollectionBase)
BaseSet(Int32, Object)

设置 NameObjectCollectionBase 实例的指定索引处的项值。Sets the value of the entry at the specified index of the NameObjectCollectionBase instance.

(继承自 NameObjectCollectionBase)
BaseSet(String, Object)

NameObjectCollectionBase 实例中第一个具有指定键的项设置值(如果有这样的项);否则将具有指定键和值的项添加到 NameObjectCollectionBase 实例中。Sets the value of the first entry with the specified key in the NameObjectCollectionBase instance, if found; otherwise, adds an entry with the specified key and value into the NameObjectCollectionBase instance.

(继承自 NameObjectCollectionBase)
Clear()

从集合中删除所有对象。Removes all objects from the collection.

CopyTo(Array, Int32)

从数组中指定的索引开始,将集合的元素复制到该数组。Copies the elements of the collection to an array, starting at the specified index in the array.

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
Get(Int32)

按索引返回状态对象。Returns a state object by index.

Get(String)

按名称返回状态对象。Returns a state object by name.

GetEnumerator()

返回一个可用于循环访问集合的枚举数。Returns an enumerator that can be used to iterate through a collection.

GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetKey(Int32)

按索引返回状态对象的名称。Returns the name of a state object by index.

GetObjectData(SerializationInfo, StreamingContext)

返回序列化 HttpApplicationStateWrapper 对象所需的数据。Returns the data that is necessary to serialize the HttpApplicationStateWrapper object.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
Lock()

锁定对集合中对象的访问,以启用同步访问。Locks access to objects in the collection in order to enable synchronized access.

MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
OnDeserialization(Object)

反序列化完成时引发反序列化事件。Raises the deserialization event when deserialization is finished.

Remove(String)

从集合中移除按名称指定的对象。Removes the object specified by name from the collection.

RemoveAll()

从集合中删除所有对象。Removes all objects from the collection.

RemoveAt(Int32)

从集合中移除按索引指定的对象。Removes the object specified by index from the collection.

Set(String, Object)

更新集合中对象的值。Updates the value of an object in the collection.

ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)
UnLock()

取消锁定对集合中对象的访问,以启用同步访问。Unlocks access to objects in the collection to enable synchronized access.

显式接口实现

ICollection.CopyTo(Array, Int32)

从目标数组的指定索引处开始将整个 NameObjectCollectionBase 复制到兼容的一维 ArrayCopies the entire NameObjectCollectionBase to a compatible one-dimensional Array, starting at the specified index of the target array.

(继承自 NameObjectCollectionBase)
ICollection.IsSynchronized

获取一个值,该值指示对 NameObjectCollectionBase 对象的访问是否同步(线程安全)。Gets a value indicating whether access to the NameObjectCollectionBase object is synchronized (thread safe).

(继承自 NameObjectCollectionBase)
ICollection.SyncRoot

获取一个对象,该对象可用于同步对 NameObjectCollectionBase 对象的访问。Gets an object that can be used to synchronize access to the NameObjectCollectionBase object.

(继承自 NameObjectCollectionBase)

扩展方法

Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

适用于