Tag Archives: C# Enumerations

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)){
  ......
}