I have already created my application on web socket with ASP.net 4.0. I just wondering is it possible to use code behind to implement the game logic in order to create the Web Socket game or keep using the separet class? what are the main different between code behind and separate C# class?
Share
The only reason you would want to put the game logic in your code behind is to tap into the page life cycle or interact with page/form elements directly. Leave your game logic in a separate class to make it more testable.
The code-behind is “connected” to the page itself as a partial class (which is how it can reside in a separate file). Your business logic and data access should reside in a separate class to try and keep the code-behind for matters more closely related to the page itself.