Compiler Error CS0439
An extern alias declaration must precede all other elements defined in the namespace
This error occurs when an extern
declaration comes after something else, such as a using
declaration, in the same namespace. The extern
declarations must come before all other namespace elements.
Example
The following example generates CS0439:
// CS0439.cs
using System;
extern alias MyType; // CS0439
// To resolve the error, make the extern alias the first line in the file.
public class Test
{
public static void Main()
{
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for