lidgren / lidgren-network-gen3

Lidgren Network Library
https://groups.google.com/forum/#!forum/lidgren-network-gen3
MIT License
1.19k stars 331 forks source link

Removed goto statement in NetPeer.Internal. #46

Closed hide1202 closed 8 years ago

hide1202 commented 8 years ago

If matched callback was existed near m_receiveCallbacks.count in m_receiveCallbacks, this code execute unnecessary statement. And i think that goto statement should avoid if possible.

AgentFire commented 8 years ago

@hide1202 you coudl just replace m_receiveCallbacks.RemoveAt(i); with m_receiveCallbacks.RemoveAt(i--);

hide1202 commented 8 years ago

@AgentFire I considered a backwards loop. But it is improved readability to use 'RemoveAll'. If you worry about performance, I can change this code to a backwards loop.