Using attributes to cut down on enum to enum mapping and enum/const to action switch statments
问题 I imagine everyone has seen code like: public void Server2ClientEnumConvert( ServerEnum server) { switch(server) { case ServerEnum.One: return ClientEnum.ABC //And so on. Instead of this badness we could do somthing like: public enum ServerEnum { [Enum2Enum(ClientEnum.ABC)] One, } Now we can use reflection to rip through ServerEnum and get the conversion mappings from the enum declaration itself. The problem I am having here is in the declaration of the Enum2Enum attribute. This works but