.net - Map two enumerations to a third single enumeration -
what best way in c# map combination of 2 enumerations third enumeration?
basically need class static method can accept enumerationa , enumerationb , in method or class have static mapping enumeration should return x,y combination.
does have examples?
your question unclear, here's guess @ want.
public enum { x, ... } public enum b { y, z, ... } public enum c { cat, dog, ... } private static readonly dictionary<tuple<a, b>, c> lookup = new dictionary<tuple<a, b>, c> { { tuple.create(a.x, b.y), c.cat }, { tuple.create(a.x, b.z), c.dog }, ...etc... }; public static c lookup(a a, b b) { return lookup[tuple.create(a, b)]; }
Comments
Post a Comment