Static classes in C#, what's the pros/cons?

前端 未结 5 748
渐次进展
渐次进展 2021-01-13 12:23

I am programming a small game for my school assignment, the game is a simple 2D game with monsters, items and bullets. Basically you run around and tries to collect all the

5条回答
  •  长发绾君心
    2021-01-13 13:16

    I think this usage of a static class is fine - especially in a single-threaded application. Like others have said, your only alternative is to pass around some sort of contextual object that contains these lists.

    My personal opinion, in this instance, is that you have chosen the best solution for your problem. It is easy to implement, easy to use, and easy to change if need be down the road.

提交回复
热议问题