Listing 10-25 extracted from chapter The .NET 2 type system from a C#2 point of view
Listing 10-24< > Listing 10-26
This listing can be compiled with the command line: csc.exe /target:exe Example_10_25.cs Errors: 0 Warnings: 0
class Program { enum Maker { Renault, Ford, Toyota } static void Main() { Maker maker = (Maker)System.Enum.Parse(typeof(Maker),"ReNaUlt",true); // Here, 'maker' is equal to 'Maker.Renault'. } }