Windows Phone Developers

Saturday, March 27, 2010

Enumeration in C#

Here is a simple way to declare and use enumerations

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;

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

1 comment:

  1. 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....

    Thanks everyone for your precious post.