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

返回

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()

适用于

另请参阅