Possible Duplicate:
How can I make an “abstract” enum in a .NET class library?
So, here is my project.
I have a network framework that has a enum called command. This basically tells the system if the packet that just came in is a CONNECT, CHAT, JOIN, etc. As a future step, I want to allow plugins to use this ‘framework’ which could provide additional command types. I know you can’t add values to existing enum’s in the subsequent plugins, so what would be the proper way to do what I want to do above? A Class? just an integer field for command, and a series of const int’s like CONNECT = 1, JOIN = 2, etc?
You should probably have one of your main message types as
plugin, so that you can delegate handling the message to the plugin itself, rather than trying to deal with these currently-unknown packets yourself. Additionally, each plugin message should include an identifier that specifies which plugin should handle it.In general, you to make the plugin system as modular as possible, so you don’t have to worry about how it will interfere with your code.