我有这个 if..else 的长循环。任何人都可以帮助我知道“switch case”是否更适合这个或“if..else”?
if (meals == null)
{
bfast.Hide();
lunch_rb.Hide();
dinner_rb.Hide();
}
else if (meals != null)
{
if (breakfast != null && lunch == null && dinner == null)
{
lunch_rb.Hide();
dinner_rb.Hide();
}
if (breakfast == null && lunch != null && dinner == null)
{
bfast.Hide();
dinner_rb.Hide();
}
if (breakfast == null && lunch == null && dinner != null)
{
bfast.Hide();
lunch_rb.Hide();
}
if (breakfast != null && lunch != null && dinner == null)
{
dinner_rb.Hide();
}
if (breakfast != null && lunch == null && dinner != null)
{
lunch_rb.Hide();
}
if (lunch != null && breakfast == null && dinner != null)
{
bfast.Hide();
}
我正在为 Windows CE 5.0 开发一个应用程序(如果有帮助的话)