views:

299

answers:

1

If I use /clr:oldSyntax the following should work:

public __value enum IceCreamFlavors
{
   Vanilla,
   Chocolate,
   Sardine,
};

what is the equivalent in non-oldSyntax? How do I declare a "managed" enum in Managed C++ for .NET 2.0?

Edit: when I follow JaredPar's advice, then if I try to pass an IceCreamFlavor to a function with the signature:

OrderFlavor(IceCreamFlavors flav)

by running

OrderFlavor(IceCreamFlavors::Sardine)

I get the error:

'IceCreamFlavors Sardine' : member function redeclaration not allowed
+1  A: 

Try

enum class IceCreamFlavors {
  Vanilla,
  Chocolate,
  Sardine,
};
JaredPar
When I do that, if I try to pass an IceCreamFlavor to a function with the signature: "OrderFlavor(IceCreamFlavors flav)" by running "OrderFlavor(IceCreamFlavors::Sardine)" I get "'IceCreamFlavors Sardine' : member function redeclaration not allowed"
brian