Compiler Error CS0667
TOC
Collapse the table of content
Expand the table of content
The document is archived and information here might be outdated

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:
© 2016 Microsoft