Should this code compile? Does it? What does it mean?
using System;class Test
{
enum Foo { Bar, Baz };
static void Main()
{
Foo f = 0.0;
Console.WriteLine(f);
}
}
Should this code compile? Does it? What does it mean?
using System;}
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Akkiraju IvaturiPosted Sep 17, 2012, 1:07 AM
VulpesPosted Sep 8, 2012, 7:03 AM
It doesn't even mind 0L, 0U or 0UL despite the fact that the underlying type of the enum is int.
Definitely contrary to the spec and quite shocking!
Thanks for pointing it out :)
Akkiraju IvaturiPosted Sep 7, 2012, 11:23 PM
Baras that's the 0 value of theFoo.