Posts

Showing posts with the label Puzzle

Coding Puzzle#1 - Generic Random Status Filler

Level: Intermediate-Advance Topic : Plain Loops Who Wins : One who accomplishes this task with least number of iterations Short Description : Create a method such that it is capable of populating enum property all objects in a list with random values based on pre-defined ratio Puzzle Details: Let’s say I’ve a following enum and a class: public enum TASK_STATUS     {         ToBeStarted,         InProgress,         Completed     }     public class TodoTask     {         public int Id { get ; set ; }         public string Comment { get ; set ; }         public TASK_STATUS Status { get ; set ; }     } I want to create 50  TodoTask fake instances and add it to a list List < TodoTask >() . How...