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