How to iterate through an enum in C#?
c#, enums
Solution
Try
foreach(var base in Enum.GetValues(typeof(Base)).Cast<Base>())
{
doc = vircurex.get_lowest_ask(base)
}
Problem
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?