I want to iterate through an enum so I can call a method with each value of that enum. How can I do that?
enum Base { ANC, BTC, DGC };
XmlDocument doc;
doc = vircurex.get_lowest_ask(Base.ANC)
doc = vircurex.get_lowest_ask(Base.BTC)
doc = vircurex.get_lowest_ask(Base.DGC)
I want it instead to be something like
foreach (var val in values)
doc = vircurex.get_lowest_ask(....)
Is there a way to do this?
Try
foreach(var base in Enum.GetValues(typeof(Base)).Cast<Base>())
{
doc = vircurex.get_lowest_ask(base)
}
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