dotnet / dotnet/csharplang

[Proposal]: Allow using alias directive to reference any kind of Type

Open
#8,645 0 comments 0 reactions 1 assignee Claimed by @CyrusNajmabadi View on GitHub
Implemented Needs ECMA Spec Proposal champion
Dominant language
C#
Stars
12.7k
Forks
1.1k
Avg merge
11h 1m
Merged PRs (30d)
3

Description

# Allow using alias directive to reference any kind of Type

* Specification: https://github.com/dotnet/csharplang/blob/main/proposals/csharp-12.0/using-alias-types.md
* Discussion: https://github.com/dotnet/csharplang/discussions/8644

## Summary
[summary]: #summary

Relax the using_alias_directive ([§13.5.2](https://github.com/dotnet/csharpstandard/blob/draft-v6/standard/namespaces.md#1352-using-alias-directives)) to allow it to point at any sort of type, not just named types. This would support types not allowed today, like: tuple types, pointer types, array types, etc. For example, this would now be allowed:

```c#
using Point = (int x, int y);
```

## Design meetings

[main/meetings/2021/LDM-2021-09-20.md#type-alias-improvements](https://github.com/dotnet/csharplang/blob/main/meetings/2021/LDM-2021-09-20.md#type-alias-improvements)
[main/meetings/2022/LDM-2022-08-31.md#using-aliases-for-any-type](https://github.com/dotnet/csharplang/blob/main/meetings/2022/LDM-2022-08-31.md#using-aliases-for-any-type)
[main/meetings/2022/LDM-2022-09-28.md#ungrouped](https://github.com/dotnet/csharplang/blob/main/meetings/2022/LDM-2022-09-28.md#ungrouped)
[main/meetings/2023/LDM-2023-01-11.md#using-aliases-for-any-types](https://github.com/dotnet/csharplang/blob/main/meetings/2023/LDM-2023-01-11.md#using-aliases-for-any-types)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.