Hen*_*man 4 .net c# struct interface
以下代码有效,但我无法弄清楚内存方面的情况.结构值在何处以及如何t
复制?
interface ITest { void Hello(); }
struct STest : ITest
{
public void Hello() { Console.WriteLine("Hello"); }
}
static ITest Make()
{
STest t = new STest();
return t;
}
static void Main(string[] args)
{
ITest it = Make();
it.Hello();
}
Run Code Online (Sandbox Code Playgroud)