سؤال

كيف يمكنني تطبيق 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();
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top