ValidatorCollection.GetEnumerator 方法的C#例子



下面的代码示例阐释了如何使用 GetEnumerator 方法。

view plaincopy to clipboardprint
?
// Get 'Validators' of the page to myCollection.   
ValidatorCollection myCollection = Page.Validators;   
  
// Get the Enumerator.   
IEnumerator myEnumerator = myCollection.GetEnumerator();   
// Print the values in the ValidatorCollection.   
string myStr = " ";   
while ( myEnumerator.MoveNext() )   
{   
   myStr 
+= myEnumerator.Current.ToString();   
   myStr 
+= " ";   
}
   
messageLabel.Text 
= myStr;  
posted @ 2007-08-11 13:57  过河卒A  阅读(310)  评论(0编辑  收藏  举报