共用方式為


StateBag.GetEnumerator 方法

定義

傳回列舉值,它可以逐一查看儲存在 StateItem 物件中之 StateBag 物件的所有索引鍵/值組。

public:
 virtual System::Collections::IDictionaryEnumerator ^ GetEnumerator();
public System.Collections.IDictionaryEnumerator GetEnumerator ();
abstract member GetEnumerator : unit -> System.Collections.IDictionaryEnumerator
override this.GetEnumerator : unit -> System.Collections.IDictionaryEnumerator
Public Function GetEnumerator () As IDictionaryEnumerator

傳回

可以逐一查看狀態包的列舉值。

實作

範例

下列範例示範如何使用 GetEnumerator 方法。

// Create a StateBag object to contain the view state 
// associated with the custom control named myControl. Use the
// StateBag.GetEnumerator method to create an
// IDictionaryEnumerator named myDictionaryEnumerator.
ctlViewState1 ctlOne = new ctlViewState1();
StateBag myStateBag = new StateBag(); 
myStateBag = ctlOne.GetState();
IDictionaryEnumerator myDictionaryEnumerator = myStateBag.GetEnumerator();
' Create a StateBag object to contain the view state 
' associated with the custom control named myControl. Use the
' StateBag.GetEnumerator method to create an
' IDictionaryEnumerator named myDictionaryEnumerator.
Dim ctlOne As New ctlViewState1()
Dim myStateBag As New StateBag()
myStateBag = ctlOne.GetState()
Dim myDictionaryEnumerator As IDictionaryEnumerator = myStateBag.GetEnumerator()

適用於

另請參閱