4 ms·
Alias-ing any type was added in C# 12 - do you mean something more than this? https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-12#alias-any-typ
by kkukshtel 2y ago
Alias-ing any type was added in C# 12 - do you mean something more than this?
https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-12#alias-any-type https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/cs...
- neonsunset 2y agoIn this case aliasing refers to memory aliasing. As in, given a common struct that represents a type union, you can overlap the fields that satisfy 'unmanaged' constraint (think int, MyStruct(short, long), Guid) between each other, but you cannot overlap them with fields that are or contain object references, because this violates the spec and GC will likely crash upon encountering data that turns into garbage when interpreted as a pointer.
- kkukshtel 2y agoAn official proposal was just submitted for type unions: https://github.com/dotnet/csharplang/blob/18a527bcc1f0bdaf542d8b9a189c50068615b439/proposals/TypeUnions.md https://github.com/dotnet/csharplang/blob/18a527bcc1f0bdaf54...