Hi everyone.
I have the following code:
public void ParseNetworkPacket(IAsyncResult iResult)
{
NetworkConnection networkConnection = (NetworkConnection)iResult.AsyncState;
string teste = NetworkPacketType.ToString();
switch (this.NetworkPacketType)
{
case NetworkPacketType.ShotPacket:
break;
case NetworkPacketType.ShotResponsePacket:
break;
case NetworkPacketType.ChatMessagePacket:
break;
default:
break;
}
networkConnection.BeginReadPacket();
}
NetworkPacketType is a enum defined by me. In the switch, depending on the type of the enum, I would call a different method. I would like to do that not using switch, because I may have too many enum types. Is there any other way to do that? Or wih an enum that's the only possible way?
Thanks in advance.