To simplify the problem, I suppose that I have a method with two boolean parameters getParamA and getParamB.
public JsonResult MyMethod(bool getParamA, bool getParamB)
Is There a way like a ternary operator or something to say if getParamA == true and getParamB == false for example, I create an anonymous object like this :
//this is an entityframework query
var result = entityContext.MyTable.Select(r=> new
{
paramA = r.paramA // because getParamA = true
// don't create paramB because getParamB is false
});
I know it is easy to implement this using two parameters (using if else condition) but things are getting complicated if we have more than 5 paramters (because you need to do all the testing)...