Skip to content

Less-than-useful example of using extern alias #33207

@RexJaeschke

Description

@RexJaeschke

As a first-time user of this feature, the example did not help me understand this message! The example makes no attempt to use MyClass. Here's a much clearer version of the code examples:

// CS0430_a.cs  
// compile with: /target:library
public class MyClass
{
    public static void M() { /*...*/ }
}

// CS0430_b.cs  
extern alias MyType;   // CS0430  
public class Test
{
    public static void Main() { MyType::MyClass.M(); }
}

It likely will be useful to also add something like this to https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/extern-alias, which doesn't quite complete the picture.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.


Associated WorkItem - 477086

Metadata

Metadata

Labels

📌 seQUESTeredIdentifies that an issue has been imported into Quest.dotnet-csharp/svcerrors-warnings/subsvcin-prThis issue will be closed (fixed) by an active pull request.okr-qualityContent-quality KR: Concerns article defects (bugs), freshness, or build warnings.

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions