如何将MarshalAsAttribute应用于下面代码的返回类型?
public ISomething Foo()
{
return new MyFoo();
}
答案 0 :(得分:36)
根据http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshalasattribute.aspx:
[return: MarshalAs(<your marshal type>)]
public ISomething Foo()
{
return new MyFoo();
}
答案 1 :(得分:2)
[return:MarshalAs]
public ISomething Foo()
{
return new MyFoo();
}