HttpApplicationState HttpApplicationState HttpApplicationState HttpApplicationState Class

定義

允許跨 ASP.NET 應用程式中的多個工作階段和要求共用全域資訊。Enables sharing of global information across multiple sessions and requests within an ASP.NET application.

public ref class HttpApplicationState sealed : System::Collections::Specialized::NameObjectCollectionBase
public sealed class HttpApplicationState : System.Collections.Specialized.NameObjectCollectionBase
type HttpApplicationState = class
    inherit NameObjectCollectionBase
Public NotInheritable Class HttpApplicationState
Inherits NameObjectCollectionBase
繼承
HttpApplicationStateHttpApplicationStateHttpApplicationStateHttpApplicationState

備註

ASP.NET 應用程式是虛擬目錄範圍內的所有檔案、頁面、處理常式、模組和程式碼的總和, 以及單一 Web 服務器上的子目錄。An ASP.NET application is the sum of all files, pages, handlers, modules, and code within the scope of a virtual directory and its subdirectories on a single Web server.

第一次用戶端HttpApplicationState從特定的 ASP.NET 應用程式虛擬目錄內要求任何 URL 資源時, 會建立類別的單一實例。A single instance of an HttpApplicationState class is created the first time a client requests any URL resource from within a particular ASP.NET application virtual directory. 針對 Web 服務器上的每個 ASP.NET 應用程式, 會建立個別的單一實例。A separate single instance is created for each ASP.NET application on a Web server. 然後會透過內部Application物件公開每個實例的參考。A reference to each instance is then exposed via the intrinsic Application object.

應用程式狀態不會在 Web 伺服陣列 (應用程式裝載于多部伺服器上) 或 Web 園 (應用程式裝載于同一部電腦上的多個進程) 之間共用。Application state is not shared across either a Web farm (in which an application is hosted across multiple servers) or a Web garden (in which an application is hosted across multiple processes on the same computer).

屬性

AllKeys AllKeys AllKeys AllKeys

取得 HttpApplicationState 集合中的便捷鍵 (Access Key)。Gets the access keys in the HttpApplicationState collection.

Contents Contents Contents Contents

取得 HttpApplicationState 物件的參考。Gets a reference to the HttpApplicationState object.

Count Count Count Count

取得 HttpApplicationState 集合中的物件數目。Gets the number of objects in the HttpApplicationState 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)
Item[Int32] Item[Int32] Item[Int32] Item[Int32]

以索引取得單一 HttpApplicationState 物件。Gets a single HttpApplicationState object by index.

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

以名稱取得單一 HttpApplicationState 物件的值。Gets the value of a single HttpApplicationState 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"。Gets all objects declared by an <object> tag where the scope is set to "Application" within the ASP.NET application.

方法

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

將新物件加入 HttpApplicationState 集合中。Adds a new object to the HttpApplicationState 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()

HttpApplicationState 集合移除所有物件。Removes all objects from an HttpApplicationState collection.

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)

以數值索引取得 HttpApplicationState 物件。Gets an HttpApplicationState object by numerical index.

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

以名稱取得 HttpApplicationState 物件。Gets an HttpApplicationState object by name.

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

傳回在 NameObjectCollectionBase 中逐一查看的列舉值。Returns an enumerator that iterates through the NameObjectCollectionBase.

(Inherited from NameObjectCollectionBase)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

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

以索引取得 HttpApplicationState 物件名稱。Gets an HttpApplicationState object name 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()

鎖定對 HttpApplicationState 變數的存取,以加速存取的同步處理。Locks access to an HttpApplicationState variable to facilitate access synchronization.

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

建立目前 Object 的淺層複本 (Shallow Copy)。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)

HttpApplicationState 集合移除指名的物件。Removes the named object from an HttpApplicationState collection.

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

HttpApplicationState 集合移除所有物件。Removes all objects from an HttpApplicationState collection.

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

根據索引從集合移除 HttpApplicationState 物件。Removes an HttpApplicationState object from a collection by index.

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

更新在 HttpApplicationState 集合中的物件值。Updates the value of an object in an HttpApplicationState collection.

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

傳回代表目前物件的字串。Returns a string that represents the current object.

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

解除對 HttpApplicationState 變數存取的鎖定,以加速存取的同步處理。Unlocks access to an HttpApplicationState variable to facilitate access synchronization.

明確介面實作

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.

適用於

執行緒安全性

此型別具備執行緒安全。This type is thread safe.

另請參閱