В шарпе чисто на switch сделать практически нереально. static String getAgeStatus(int age) { int type = 6; if (age < 1) type = 1; if ((age >= 1) && (age <= 11)) type = 2; if ((age >= 12) && (age <= 15)) type = 3; if ((age >= 16) && (age <= 25)) type = 4; if ((age >= 26) && (age <= 70)) type = 5; switch (type) { case 1:return "младенец"; case 2: return "ребенок"; case 3: return "подросток"; case 4: return "юноша"; case 5: return "мужчина"; default: return "пожилой человек"; } }
static String getAgeStatus(int age)
{
int type = 6;
if (age < 1) type = 1;
if ((age >= 1) && (age <= 11)) type = 2;
if ((age >= 12) && (age <= 15)) type = 3;
if ((age >= 16) && (age <= 25)) type = 4;
if ((age >= 26) && (age <= 70)) type = 5;
switch (type)
{
case 1:return "младенец";
case 2: return "ребенок";
case 3: return "подросток";
case 4: return "юноша";
case 5: return "мужчина";
default: return "пожилой человек";
}
}