如何将结构作为接口返回工作?

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)

kem*_*002 9

当您将结构转换为接口时,如果您要求的话,它会将结构框包装起来? http://blogs.msdn.com/abhinaba/archive/2005/10/05/477238.aspx