I need to declare the query variable outside the switch statement that way I would only have one variable that would handle different result of the LINQ Query. Please see the code below. Problem here is that I cannot infer a variable without initializing it
var query;
Switch(filter)
{
case 1:
var query = from c in Customers
where c.Type equals == 'ABC'
select c;
break;
case 2:
var query = from c in Customers
where c.Type equals == 'CDE'
select c;
break;
}
foreach(var custrow in query)
{
//Do Logic
}
}