Replies: 1 comment 2 replies
-
|
As for the type of In current proposal the For example, property / list pattern matching then can work on such a union directly: [Union]
struct AnyStream
{
private readonly Stream? _value;
public AnyStream(FileStream s) => _value = s;
public AnyStream(MemoryStream s) => _value = s;
public Stream? Value => _value;
}
if (u is { CanRead: true }) { } // OK
[Union]
struct IntSeq
{
private readonly IReadOnlyList<int>? _value;
public IntSeq(int[] a) => _value = a;
public IntSeq(List<int> l) => _value = l;
public IReadOnlyList<int>? Value => _value;
}
if (u is [1, .., 3]) { } // OK |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
https://github.com/dotnet/csharplang/blob/main/meetings/2026/LDM-2026-02-11.md
Agenda
Beta Was this translation helpful? Give feedback.
All reactions