¿Cómo se aplica un atributo .net a un tipo de retorno?
-
02-07-2019 - |
Pregunta
¿Cómo aplico el atributo MarshalAsAttribute al tipo de devolución del código a continuación?
public ISomething Foo()
{
return new MyFoo();
}
Solución
De acuerdo a http://msdn.microsoft. com / en-us / library / system.runtime.interopservices.marshalasattribute.aspx :
[return: MarshalAs(<your marshal type>)]
public ISomething Foo()
{
return new MyFoo();
}
Otros consejos
[return:MarshalAs]
public ISomething Foo()
{
return new MyFoo();
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow