E
Eric S.
Why doesn't something like this work? I get "a constant value is
expected" on all 3 case statements.
private DataGrid CurrentDataGrid(DataGrid firstDg, DataGrid secondDg)
{
try
{
switch (true)
{
case firstDg.Items.Count != 0 & secondDg.Items.Count != 0:
throw new Exception();
break;
case firstDg.Items.Count != 0:
return firstDg;
case secondDg.Items.Count != 0:
return secondDg;
default:
return null;
}
}
catch
{
return null;
}
}
expected" on all 3 case statements.
private DataGrid CurrentDataGrid(DataGrid firstDg, DataGrid secondDg)
{
try
{
switch (true)
{
case firstDg.Items.Count != 0 & secondDg.Items.Count != 0:
throw new Exception();
break;
case firstDg.Items.Count != 0:
return firstDg;
case secondDg.Items.Count != 0:
return secondDg;
default:
return null;
}
}
catch
{
return null;
}
}