Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0667

Visual Studio .NET 2003

The feature 'MarshalAs attribute on method' is deprecated. Please use 'return : location override with MarshalAs attribute' instead'

The following sample generates CS0667:

// CS0667.cs
using System.Runtime.InteropServices;

public interface MyInterface
{
   [MarshalAs(UnmanagedType.LPWStr )] string Test(); // CS0667
   // try the following line instead
   // [return: MarshalAs(UnmanagedType.LPWStr)] string Test();

}

class MyTestClass
{
   static void Main()
   {
   }
}

See Also

COM Interop Tutorials | Platform Invoke Tutorial

Show:
© 2014 Microsoft