tags:

views:

62

answers:

1
+3  A: 

As the error says, it's not a real enum.

It sounds like you need reflection:

var fields = typeof(Language).GetFields(BindingFlags.Static 
                                        | BindingFlags.Public);
foreach (string item in fields.Select(field => field.GetValue(null)))
{
     // ...
}

That's assuming there are no other public static fields in the type. You could always filter by type etc.

Jon Skeet
Thank you very much sir. Your helpful answer just solved my problem.
Ehsan