void Main()
{
GetResult();
}
public Result GetResult()
{
var result = new Result();
bool condition1overridesCondition2 = true; // Configuration value
bool condition2 = true;
bool? condition3overridesCondition3 = true;
bool? condition4 = false;
// ... more conditions
if (!condition1overridesCondition2)
{
result.Valid = false;
result.Reason = "A";
return result;
}
if (!condition2) {
result.Valid = false;
result.Reason = "B";
}
if (condition3overridesCondition3 != true) {
result.Valid = false;
result.Reason = "C";
}
result.Valid = condition4 == true;
result.Reason = "D";
// ... More evaluations
return result;
}
public class Result
{
public string Reason { get; set; }
public bool Valid { get; set; }
}
void Main()
{
GetResult();
}
public Result GetResult()
{
var result = new Result();
bool condition1overridesCondition2 = true; // Configuration value
bool condition2 = true;
bool? condition3overridesCondition3 = true;
bool? condition4 = false;
// ... more conditions
if (!condition1overridesCondition2)
{
result.Valid = false;
result.Reason = "A";
return result;
}
if (!condition2) {
result.Valid = false;
result.Reason = "B";
}
if (condition3overridesCondition3 != true) {
result.Valid = false;
result.Reason = "C";
}
result.Valid = condition4 == true;
result.Reason = "D";
// ... More evaluations
return result;
}
public class Result
{
public string Reason { get; set; }
public bool Valid { get; set; }
}