基本上,我有一些类调用静态void提供了参数(used in an ASP website).
从我的理解,因为虚空有它自己的堆栈它是线程安全的,但是我不完全确定在使用输出时是否为真.有人可以澄清这个问题.谢谢!
namespace ThreadTest
{
class Program
{
static void Main(string[] args)
{
int helloWorldint = 0;
bool helloWorldbool = false;
int helloWorldintOut = 0;
bool helloWorldboolOut = false;
setHelloWorlds(helloWorldint, helloWorldbool, out helloWorldintOut, out helloWorldboolOut);
Console.WriteLine(helloWorldintOut);
Console.WriteLine(helloWorldboolOut);
}
public static void setHelloWorlds(int helloWorldint, bool helloWorldbool, out int helloWorldintOut, out bool helloWorldboolOut)
{
helloWorldintOut = helloWorldint + 1;
helloWorldboolOut = true;
}
}
}
Run Code Online (Sandbox Code Playgroud)