17

如何将 MarshalAsAttribute 应用于下面代码的返回类型?

public ISomething Foo()
{
    return new MyFoo();
}
4

2 回答 2

40

根据http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshalasattribute.aspx

[return: MarshalAs(<your marshal type>)]
public ISomething Foo()
{
    return new MyFoo();
}
于 2008-09-25T04:24:44.713 回答
3
[return:MarshalAs]
public ISomething Foo()
{
    return new MyFoo();
}
于 2008-09-25T04:25:35.307 回答