Como você aplicar um atributo .net para um tipo de retorno
-
02-07-2019 - |
Pergunta
Como posso aplicar o MarshalAsAttribute para o tipo de retorno do código abaixo?
public ISomething Foo()
{
return new MyFoo();
}
Solução
De acordo com a http://msdn.microsoft. com / en-us / library / system.runtime.interopservices.marshalasattribute.aspx :
[return: MarshalAs(<your marshal type>)]
public ISomething Foo()
{
return new MyFoo();
}
Outras dicas
[return:MarshalAs]
public ISomething Foo()
{
return new MyFoo();
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow