Hashtable枚举 [英] Hashtable enumeration

查看:85
本文介绍了Hashtable枚举的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过哈希表循环更改每个条目的值?无论是什么

我尝试我似乎总是得到关于修改

循环中的集合的错误。

How can I loop thru a hashtable changing the Value of each entry ? Whatever
I try I always seem to get the error about modifying the collection within
the loop.

推荐答案

看看下面的文章,它可能有助于揭示一些事情...

http://msdn.microsoft.com/vcsharp/de...res_guide2.asp


保重,

Ben S. Stahlhood II

" JezB" < JE ************* @ blueyonder.co.yk>在消息中写道

新闻:uA ************** @ TK2MSFTNGP10.phx.gbl ...
Check out the following article, it might help shed some light on things...

http://msdn.microsoft.com/vcsharp/de...res_guide2.asp

Take care,
Ben S. Stahlhood II
"JezB" <je*************@blueyonder.co.yk> wrote in message
news:uA**************@TK2MSFTNGP10.phx.gbl...
我如何循环通过改变每个条目的值的哈希表?
无论我尝试什么,我似乎总是得到关于在循环中修改集合的错误。
How can I loop thru a hashtable changing the Value of each entry ? Whatever I try I always seem to get the error about modifying the collection within
the loop.



foreach (DictionaryEntry de in blahblah)

{

}

" JezB" < JE ************* @ blueyonder.co.yk>在消息中写道

新闻:uA ************** @ TK2MSFTNGP10.phx.gbl ...
foreach (DictionaryEntry de in blahblah)
{
}
"JezB" <je*************@blueyonder.co.yk> wrote in message
news:uA**************@TK2MSFTNGP10.phx.gbl...
我如何循环通过改变每个条目的值的哈希表?
无论我尝试什么,我似乎总是得到关于在循环中修改集合的错误。
How can I loop thru a hashtable changing the Value of each entry ? Whatever I try I always seem to get the error about modifying the collection within
the loop.



来自文档:

foreach语句是枚举器的包装器,它只允许读取而不是写入该集合。


< di ******** @ discussion.microsoft.com>在消息中写道

news:u
From the docs:
The foreach statement is a wrapper around the enumerator, which only allows
reading from, not writing to, the collection.

<di********@discussion.microsoft.com> wrote in message
news:u


这篇关于Hashtable枚举的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆