Static classes in c#

前端 未结 8 711
别那么骄傲
别那么骄傲 2021-01-18 03:09

In answering this question (https://stackoverflow.com/questions/352317/c-coding-question#352327), it got me wondering...

Is there any danger in regarding a static cl

8条回答
  •  鱼传尺愫
    2021-01-18 04:00

    Not sure about C#, but in C++ a static Object will get initialized when it gets initialized, and you have no direct control over that (especially in multithreaded apps). So you need a function to call your object, not just call it directly (unless you want unportable code)

提交回复
热议问题