Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Compiler Error CS0179

'member' cannot be extern and declare a body

When a class member is marked extern, it means that the member's definition is located in another file. Therefore, a class member marked as extern cannot be defined in the class. Either remove the extern keyword or delete the definition. For more information, see Methods (C# Programming Guide).

The following sample generates CS0179:

// CS0179.cs
public class MyClass
   public extern int ExternMethod(int aa)   // CS0179
      return 0;
   // try the following line instead
   // public extern int ExternMethod(int aa);

   public static void Main()
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.