“Global variable” in Visual C#

前端 未结 5 1174
眼角桃花
眼角桃花 2021-01-23 21:26

I have made the Graph class, and i want to simulate a distribution network. The Graph works 100%. But, i want to use that same struct/class in all my application! For example: I

5条回答
  •  走了就别回头了
    2021-01-23 21:36

    Make a static class. The variables that need global access, put them inside that class.

    Even better idea would be to use Singleton objects to represent globally accessible objects.

提交回复
热议问题