You could do it with arrays of Func.
static Func<bool,bool> isTrue = delegate(bool b) { return b; };
static Func<bool,bool> isFalse = delegate(bool b) { return !b; };
static Func<bool,bool> isIrrelevant = delegate(bool b) { return true; };
Now you could put your matrix into a Dictionary like this:
Dictionary<string,Func<bool,bool>[]> decisionMatrix = new Dictionary<string,Func<bool,bool>[]>();
// 0 | 1 | - | 1 | 0 | 1 | - | 1
matrix.Add("Decision01", new Func<bool,bool>{isFalse, isTrue, isIrrelevant, isTrue, isFalse, isTrue, isIrrelevant, isTrue});
Finally for every given input array:
bool[] input = new bool[]{ false, true, false, true, false, true, false, true}
string matchingRule = null;
foreach( var pair in matrix ) {
bool result = true;
for( int i = 0; i < input.Length; i++) {
// walk over the function array and call each function with the input value
result &= pair.Value[i](input[i]);
}
if (result) { // all functions returned true
// we got a winner
matchingRule = pair.Key;
break;
}
}
// matchingRule should now be "Decision01"
This should probably get some more checks (e.g. checking that the input array has the correct size) but should give you some idea. Using Funcs also gives you some more flexibility in case you get a fourth state.