كيف يمكنك تطبيق سمة .net على نوع الإرجاع
-
02-07-2019 - |
سؤال
كيف يمكنني تطبيق MarshalAsAttribute على نوع الإرجاع للكود أدناه؟
public ISomething Foo()
{
return new MyFoo();
}
المحلول
وفق 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();
}
لا تنتمي إلى StackOverflow