I have this class:
class A {
string name;
string code;
}
Examples:
A1: name="blabla", code="kuku"
A2: name="blabla", code=null
A3: name=null, code="kuku"
Dictionary<A, string> d=new Dictionary<A, string>();
d[A1]="aaa";
d[A2]="bbb"
results: d[A1]="bbb";
d[A1]="aaa";
d[A3]="bbb"
results: d[A1]="bbb";
d[A2]="aaa";
d[A3]="bbb"
results: d[A2]="aaa"; d[A3]="bbb";
Is there a way to implement class A as a Key to dictionary?
To answer your edited question:
Make two different string dictionaries (one for Name and one for Code) and search whichever one you have a value for.