I have an enum value that represent a range of week days (e.g. Sunday until Friday) that I present to user in a friendly name.
I tried to give it the value
(SunTilTHur = DayOfWeek.Sunday + DayOfWeek.Monday + DayOfWeek.Tuesday)
but I'm getting the error
The switch statement contains multiple cases with the label value
The code I tried:
public MyDayOfWeek Days { get; set; }
public string DaysFriendlyName => this.Days.ToFriendlyName();`
public enum MyDayOfWeek
{
Sunday = DayOfWeek.Sunday,
Monday = DayOfWeek.Monday,
// ..
SunTilFir = DayOfWeek.Sunday + DayOfWeek.Monday + DayOfWeek.Tuesday,//+...
public static string ToFriendlyName(this MyDayOfWeek days)
{
switch (days)
{
case MyDayOfWeek.SunTilFir:
return @Resources.FormResources.SunTilFri;
Is it possible to set this values and how? Thanks in advance.