C# – Creating GUIDs and Working with Enumerations

GUID means Globally Unique Identifier

System.GUID newGUID = System.Guid.NewGuid();

Working with Enumerations

A data type accepting only enumerated values that you define.

Strongly typed, ridding you app  of “magic strings”.

public enum Occupation{
  Doctor,
  Lawyer,
  IndianChef
}
Occupation whatIDo = Occupation.IndianChef;

Occupation occupation;

if(Enum.TryParse("Doctor", out occupation)){
  ......
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s