What is the equivalent of nextElement() from Java?
I have the following code:
IEnumerable<String> e = (IEnumerable<String>)request
.Params;
while (e.Count() > 1)
{
//
//String name = e.nextElement();
String name = e. // what method?
}
You should be using the foreach
loop:
foreach (string name in request.Params)
{
// Do something for each name
}
If you really want to use the raw enumerable, then you have call its GetEnumerator()
method:
using (IEnumerator<string> enumerator = request.Params.GetEnumerator())
{
while (enumerator.MoveNext())
{
string name = enumerator.Current;
// Do something for each name
}
}
However, the foreach syntax is much clearer. Use that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With