I have a NameValueCollection
, and want to iterate through the values. Currently, I’m doing this, but it seems like there should be a neater way to do it:
var enu = myNameValueCollection.GetEnumerator();
while (enu.MoveNext())
{
string key = (string)enu.Current;
string value = myNameValueCollection[key];
}
OR when keys nullable:
for (int i = 0; i < myNameValueCollection.Count; i++)
{
string key = myNameValueCollection.GetKey(i);
string value = myNameValueCollection.Get(i);
}