Does a static method share its local variables & what happens during concurrent usage from different threads?

后端 未结 4 1743
故里飘歌
故里飘歌 2021-01-17 15:21

C# Question - I\'m trying to determine whether it is OK to use a static method where, within the method it does have some local variables it uses. Are the local variables \

4条回答
  •  再見小時候
    2021-01-17 15:41

    There are plenty of reasons to use static methods in multi-threaded apps. Nothing wrong with that either. As long as you do not change any global variables (without locking) you should have no problems there.

提交回复
热议问题