Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you apply a .net attribute to a return type

How do I apply the MarshalAsAttribute to the return type of the code below?

public ISomething Foo()
{
    return new MyFoo();
}
like image 865
Kepboy Avatar asked Sep 25 '08 04:09

Kepboy


1 Answers

According to http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshalasattribute.aspx:

[return: MarshalAs(<your marshal type>)]
public ISomething Foo()
{
    return new MyFoo();
}
like image 50
Franci Penov Avatar answered Sep 16 '22 14:09

Franci Penov