14
Wie wende ich das MarshalAsAttribute an den Rückgabetyp des folgenden Codes an?Wie wenden Sie ein .net-Attribut auf einen Rückgabetyp an
public ISomething Foo()
{
return new MyFoo();
}
Wie wende ich das MarshalAsAttribute an den Rückgabetyp des folgenden Codes an?Wie wenden Sie ein .net-Attribut auf einen Rückgabetyp an
public ISomething Foo()
{
return new MyFoo();
}
Nach 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();
}