Declaration is by using the enum keyword
public enum playerType { ClassA, ClassB, ClassC, Contract }
And you can use as shown below:
ClassTeam CT = new ClassTeam();
CT.PlayerType = ClassTeam.playerType.Contract;
Visual Studio .NET Tips and Tricks, VB.NET Code Samples, C# Code Snippets, ASP.NET Code Samples, .NET Tips and Tricks, C# Tips & Tricks, Visual Studio 2010, .NET Framework Code Samples, VB.NET Tips & Tricks
public enum playerType { ClassA, ClassB, ClassC, Contract }
ClassTeam CT = new ClassTeam();
CT.PlayerType = ClassTeam.playerType.Contract;
This is one of the best answer so far, I have read online. Just useful information. Very well presented. Thanks for sharing with us. I had found another nice post with wonderful explanation on Enumeration in c#, which is also helped me to complete my task. For more details of that post check out this link....
ReplyDeletehttp://mindstick.com/Articles/ade257fc-7058-4f60-a0fe-85c7ca52f004/?Enumeration%20in%20c#
Thanks everyone for your precious post.