如何申请一个.NET属性返回类型属性、类型、NET

2023-09-03 00:46:01 作者:吖!查無此人

如何申请的MarshalAsAttribute以低于code中的返回类型?

 公共ISomething富()
{
    返回新MyFoo();
}
 

解决方案

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

  [返回:的MarshalAs(<您的名帅型>)
公共ISomething美孚()
{
    返回新MyFoo();
}
 

.net网站项目怎么将嵌入互操作类型属性设置为false.

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

public ISomething Foo()
{
    return new MyFoo();
}

解决方案

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();
}