Skip to content

using directive – some mistakes #27331

@deep-outcome

Description

@deep-outcome

You can combine both modifiers to import the static members from a type in all source files in your project.

to all source files


Otherwise, compiler error CS1529 is generated.

That is truth only for using and using alias. For global using it is Error CS8914 A global using directive cannot be used in a namespace declaration. Also there exists Error CS8915 A global using directive must precede all non-global using directives. thus statement

In any namespace, but before any namespaces or types declared in that namespace, unless the global modifier is used, in which case the directive must appear before all namespace and type declarations.

should be reworded. Better to specify global using behavior – before other using types, not nested at top of file – separetely from using and using alias that are equal in their behavior.


Document Details

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


Associated WorkItem - 343932

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions