HttpApplicationStateBase HttpApplicationStateBase HttpApplicationStateBase HttpApplicationStateBase Class

定义

用作一些类的基类,这些类可实现在 ASP.NET 应用程序内跨多个会话和请求共享信息。Serves as the base class for classes that enable information to be shared across multiple sessions and requests within an ASP.NET application.

public ref class HttpApplicationStateBase abstract : System::Collections::Specialized::NameObjectCollectionBase, System::Collections::ICollection
public abstract class HttpApplicationStateBase : System.Collections.Specialized.NameObjectCollectionBase, System.Collections.ICollection
type HttpApplicationStateBase = class
    inherit NameObjectCollectionBase
    interface ICollection
    interface IEnumerable
Public MustInherit Class HttpApplicationStateBase
Inherits NameObjectCollectionBase
Implements ICollection
继承
HttpApplicationStateBaseHttpApplicationStateBaseHttpApplicationStateBaseHttpApplicationStateBase
派生
实现

注解

类是一个抽象类, 它包含与HttpApplicationState类相同的成员。 HttpApplicationStateBaseThe HttpApplicationStateBase class is an abstract class that contains the same members as the HttpApplicationState class. 利用类, 您可以创建HttpApplicationState类似于类的派生类, 但可以自定义该派生类并在 ASP.NET 管道之外工作。 HttpApplicationStateBaseThe HttpApplicationStateBase class lets you create derived classes that are like the HttpApplicationState class, but that you can customize and that work outside the ASP.NET pipeline. 执行单元测试时, 通常使用派生类来实现具有自定义行为的成员, 该行为可满足你要测试的方案。When you perform unit testing, you typically use a derived class to implement members with customized behavior that fulfills the scenario you are testing.

HttpApplicationStateWrapper 类是从 HttpApplicationStateBase 类派生的。The HttpApplicationStateWrapper class derives from the HttpApplicationStateBase class. 类用作HttpApplicationState类的包装。 HttpApplicationStateWrapperThe HttpApplicationStateWrapper class serves as a wrapper for the HttpApplicationState class. 在运行时, 通常使用HttpApplicationStateWrapper类的实例来调用HttpApplicationState对象的成员。At run time, you typically use an instance of the HttpApplicationStateWrapper class to call members of the HttpApplicationState object.

构造函数

HttpApplicationStateBase() HttpApplicationStateBase() HttpApplicationStateBase() HttpApplicationStateBase()

初始化该类供继承的类实例使用。Initializes the class for use by an inherited class instance. 此构造函数只能由继承的类调用。This constructor can only be called by an inherited class.

属性

AllKeys AllKeys AllKeys AllKeys

当在派生类中重写时,获取集合中对象的访问键。When overridden in a derived class, gets the access keys for the objects in the collection.

Contents Contents Contents Contents

在派生类中重写时,获取对 HttpApplicationStateBase 对象的引用。When overridden in a derived class, gets a reference to the HttpApplicationStateBase object.

Count Count Count Count

当在派生类中重写时,获取集合中对象的数目。When overridden in a derived class, gets the number of objects in the collection.

ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized ICollection.IsSynchronized

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

(Inherited from NameObjectCollectionBase)
ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot ICollection.SyncRoot

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

(Inherited from NameObjectCollectionBase)
IsReadOnly IsReadOnly IsReadOnly IsReadOnly

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

(Inherited from NameObjectCollectionBase)
IsSynchronized IsSynchronized IsSynchronized IsSynchronized

当在派生类中重写时,获取一个值,该值指示对集合的访问是否是线程安全的。When overridden in a derived class, gets a value that indicates whether access to the collection is thread-safe.

Item[Int32] Item[Int32] Item[Int32] Item[Int32]

当在派生类中重写时,按索引获取状态对象。When overridden in a derived class, gets a state object by index.

Item[String] Item[String] Item[String] Item[String]

当在派生类中重写时,按名称获取状态对象。When overridden in a derived class, gets a state object by name.

Keys Keys Keys Keys

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

(Inherited from NameObjectCollectionBase)
StaticObjects StaticObjects StaticObjects StaticObjects

当在派生类中重写时,获取由 object 元素声明的所有对象,其中范围设置为 ASP.NET 应用程序中的“Application”。When overridden in a derived class, gets all objects that are declared by an object element where the scope is set to "Application" in the ASP.NET application.

SyncRoot SyncRoot SyncRoot SyncRoot

当在派生类中重写时,获取一个对象,该对象可用于同步对集合的访问。When overridden in a derived class, gets an object that can be used to synchronize access to the collection.

方法

Add(String, Object) Add(String, Object) Add(String, Object) Add(String, Object)

在派生类中重写时,将新对象添加到集合。When overridden in a derived class, adds a new object to the collection.

BaseAdd(String, Object) BaseAdd(String, Object) BaseAdd(String, Object) BaseAdd(String, Object)

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

(Inherited from NameObjectCollectionBase)
BaseClear() BaseClear() BaseClear() BaseClear()

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

(Inherited from NameObjectCollectionBase)
BaseGet(Int32) BaseGet(Int32) BaseGet(Int32) BaseGet(Int32)

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

(Inherited from NameObjectCollectionBase)
BaseGet(String) BaseGet(String) BaseGet(String) BaseGet(String)

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

(Inherited from NameObjectCollectionBase)
BaseGetAllKeys() BaseGetAllKeys() BaseGetAllKeys() BaseGetAllKeys()

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

(Inherited from NameObjectCollectionBase)
BaseGetAllValues() BaseGetAllValues() BaseGetAllValues() BaseGetAllValues()

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

(Inherited from NameObjectCollectionBase)
BaseGetAllValues(Type) BaseGetAllValues(Type) BaseGetAllValues(Type) BaseGetAllValues(Type)

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

(Inherited from NameObjectCollectionBase)
BaseGetKey(Int32) BaseGetKey(Int32) BaseGetKey(Int32) BaseGetKey(Int32)

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

(Inherited from NameObjectCollectionBase)
BaseHasKeys() BaseHasKeys() BaseHasKeys() BaseHasKeys()

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

(Inherited from NameObjectCollectionBase)
BaseRemove(String) BaseRemove(String) BaseRemove(String) BaseRemove(String)

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

(Inherited from NameObjectCollectionBase)
BaseRemoveAt(Int32) BaseRemoveAt(Int32) BaseRemoveAt(Int32) BaseRemoveAt(Int32)

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

(Inherited from NameObjectCollectionBase)
BaseSet(Int32, Object) BaseSet(Int32, Object) BaseSet(Int32, Object) BaseSet(Int32, Object)

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

(Inherited from NameObjectCollectionBase)
BaseSet(String, Object) BaseSet(String, Object) BaseSet(String, Object) 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.

(Inherited from NameObjectCollectionBase)
Clear() Clear() Clear() Clear()

当在派生类中重写时,从集合中删除所有对象。When overridden in a derived class, removes all objects from the collection.

CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32) CopyTo(Array, Int32)

在派生类中重写时,从数组中指定的索引开始,将集合的元素复制到该数组。When overridden in a derived class, copies the elements of the collection to an array, starting at the specified index in the array.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
Get(Int32) Get(Int32) Get(Int32) Get(Int32)

当在派生类中重写时,按索引获取状态对象。When overridden in a derived class, gets a state object by index.

Get(String) Get(String) Get(String) Get(String)

当在派生类中重写时,按名称获取状态对象。When overridden in a derived class, gets a state object by name.

GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()

当在派生类中重写时,返回可用于循环访问集合的枚举数。When overridden in a derived class, returns an enumerator that can be used to iterate through the collection.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

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

(Inherited from Object)
GetKey(Int32) GetKey(Int32) GetKey(Int32) GetKey(Int32)

当在派生类中重写时,按索引获取状态对象的名称。When overridden in a derived class, gets the name of a state object by index.

GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext)

实现 ISerializable 接口,并返回序列化 NameObjectCollectionBase 实例所需的数据。Implements the ISerializable interface and returns the data needed to serialize the NameObjectCollectionBase instance.

(Inherited from NameObjectCollectionBase)
GetType() GetType() GetType() GetType()

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

(Inherited from Object)
Lock() Lock() Lock() Lock()

当在派生类中重写时,锁定对集合中对象的访问,以启用同步访问。When overridden in a derived class, locks access to objects in the collection in order to enable synchronized access.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

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

(Inherited from Object)
OnDeserialization(Object) OnDeserialization(Object) OnDeserialization(Object) OnDeserialization(Object)

实现 ISerializable 接口,并在完成反序列化之后引发反序列化事件。Implements the ISerializable interface and raises the deserialization event when the deserialization is complete.

(Inherited from NameObjectCollectionBase)
Remove(String) Remove(String) Remove(String) Remove(String)

当在派生类中重写时,从集合中移除命名对象。When overridden in a derived class, removes the named object from the collection.

RemoveAll() RemoveAll() RemoveAll() RemoveAll()

当在派生类中重写时,从集合中删除所有对象。When overridden in a derived class, removes all objects from the collection.

RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32) RemoveAt(Int32)

当在派生类中重写时,从集合中移除按索引指定的状态对象。When overridden in a derived class, removes a state object specified by index from the collection.

Set(String, Object) Set(String, Object) Set(String, Object) Set(String, Object)

当在派生类中重写时,更新集合中对象的值。When overridden in a derived class, updates the value of an object in the collection.

ToString() ToString() ToString() ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(Inherited from Object)
UnLock() UnLock() UnLock() UnLock()

当在派生类中重写时,取消锁定对集合中对象的访问,以启用同步访问。When overridden in a derived class, unlocks access to objects in the collection to enable synchronized access.

显式界面实现

ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32) ICollection.CopyTo(Array, Int32)

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

(Inherited from NameObjectCollectionBase)

扩展方法

Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable) Cast<TResult>(IEnumerable)

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

OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable) OfType<TResult>(IEnumerable)

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

AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable) AsParallel(IEnumerable)

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

AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable) AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

适用于