How to convert CSV string to List<Enum>
c#, generics
Solution
csv.Split(',').Select(s => (Events)Enum.Parse(typeof(Events), s));
BTW with generic enum class you can parse this way `Enum<Events>.Parse(s)` and whole code will look like:
csv.Split(',').Select(Enum<Events>.Parse)
Problem
I have defined enum events: ``` public enum Events { UNLOCK = 1, LOCK = 2 } ``` as well as CSV string: ``` var csv = "1,2"; ``` What would be preferable way to convert csv string to List< Events> in C#?