I am fetching a database row inside my c# code. Row contains 3 different flags (3 columns with true or false values). Only one of these columns will be true and that will determine the type of that object. How can i determine the type of that object in one line of code. If all three flags are false then i need to have a default type.
var myObject = this.unitOfWork.myRepository.GetMeObject();
var objectType = myObject .IsA == true
? "A"
: myObject .IsB == true
? "B"
: myObject .IsC == true
? "C"
: "D";
If none of the condition is valid then ObjectType should be D
Any suggestion will be much appreciated.
Thanks