[Mono-devel-list] MCS Enum bug

Todd Berman tberman at gentoo.org
Fri Jan 2 20:31:40 EST 2004


This fails on mono and .net when compiled with mcs and is ripped
basically right out of #D so it works and compiles with csc. I assume ;)

--Todd
-------------- next part --------------
using System;

namespace EnumParseBug {
	public enum IndentStyle {
		None,
		Auto, 
		Smart
	}
	
	public class EnumParseBug {
		public static void Main(string [] args) {
			Enum as_enum           = (Enum)        Enum.Parse(typeof(IndentStyle), "Smart");
			IndentStyle as_indent  = (IndentStyle) Enum.Parse(typeof(IndentStyle), "Smart");

			if (as_indent != IndentStyle.Smart) {
				Console.WriteLine("Bug in Enum.Parse");
			}
			if ( ((IndentStyle) as_enum) != IndentStyle.Smart ) {
				Console.WriteLine("Bug in cast from Enum to IndentStyle");
			}
		}
	}
}


More information about the Mono-devel-list mailing list