I'm currently working with culture Info and need to translate some words. For the days, i use this :
--> input : an array DayDetails : [MO,TU, WE, TH, FR]
or [MO, WE,TH,FR,SA]
...
if ( daysDetails.Length == 7 )
{
return langSpec.GetLocalMessage( "every" ) + " " + langSpec.GetLocalMessage( "Days" );
}
else if( daysDetails.Length == 5 && daysDetails.Contains( "MO" ) && daysDetails.Contains( "TU" ) && daysDetails.Contains( "WE" ) && daysDetails.Contains( "TH" ) && daysDetails.Contains( "FR" ) )
{
return langSpec.GetLocalMessage( "workingDays" );
}
output : a string
with : Monday, Thuesday, Wednesday
if there's 5 days and it's the working days i want : a string
with : working days
if there's 7 days i want : a string
with "every days"
the thing is, i don't like how my second if looks but i have to test, in case of 5 days, that the days are the working days to proper translate it.
Is there a better way to write this, other than multiple && ?
Sorry for my bad english speaking, hope you'll understand.
EDIT : DayDetails can be also [MO,TH], or [MO] or [FR,WE,TH,TU,MO] since it's a response i got from somewhere else and i can't master the input.
EDIT 2 : i checked Compare two List<T> objects for equality, ignoring order since multiple people suggested it, but it does not really answer to my question. the answer given is way more complicated that my initial "if" with 5 statements.