如何在其中声明具有固定大小数组的结构?
我找到了解决方案,但它只适用于原始数据类型.我需要我的阵列类型MyStruct.
那么如何在其中声明一个包含其他结构数组的结构?
恩.
unsafe struct Struct1{
fixed int arrayInt[100]; // works properly
fixed Struct2 arrayStruct[100]; //not compile
}
Run Code Online (Sandbox Code Playgroud) 我的应用程序中有这样的代码:
var t = new Thread(new ThreadStart(new Action(SomeClass.SomeMethod)));
t.Start();
...
t.Join();
Run Code Online (Sandbox Code Playgroud)
但据我所知,编译器进行了一些优化,并在与主代码相同的线程中运行SomeMethod.我通过在t和Thread.CurrentThread中设置线程的不同名称来检查这一点.我如何创建和运行线程以确保它是新线程.