Skip to content

Instantly share code, notes, and snippets.

@primaryobjects
Last active August 29, 2015 14:23
Show Gist options
  • Select an option

  • Save primaryobjects/a7cfb9217d586a759767 to your computer and use it in GitHub Desktop.

Select an option

Save primaryobjects/a7cfb9217d586a759767 to your computer and use it in GitHub Desktop.
Declaring an enum with a getter and no setter compiles in VS2015, but no in VS2013.
Why does this code compile in Visual Studio 2015, but not in Visual Studio 2013? Hmmm?
------
VS2013:
'EnumTest.Dude.thing.get' must declare a body because it is not marked abstract or extern. Automatically implemented properties must define both get and set accessors.
namespace EnumTest
{
public enum Thing
{
One,
Two,
Three
};
public class Dude
{
Thing thing { get; }
}
class Program
{
static void Main(string[] args)
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment