public IList<UserType> UserTypes { get { // Will result in a list like {"Tester", "Engineer"} return Enum.GetValues(typeof(UserType)).Cast<UserType>().ToList<UserType>(); } } public UserType UserType { get; set; }
Enum .GetValues(typeof(UserType)) // Get all values of the enum... This will return an array of object .Cast<UserType>() // cast each object to enum UserType - This will return a IEnumerable<UserType> .ToList<UserType>(); // Convert the IEnumerable<UserType> to a list of UserTypes
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)