Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
2A5F authored Feb 22, 2025
1 parent 26bb6e4 commit c131910
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ public readonly partial struct Union1

#### How to use

Multiple usage methods, you can manually determine the Tag field, or use pattern matching

```cs
var u = Union1.MakeA(123);

Expand All @@ -314,6 +316,20 @@ if (u.IsA)
{
var a = u.A;
}

switch (u.Tag)
{
case Union1.Tags.A:
break;
...
}

switch (u.Tag)
{
case { IsA: true, A: var a }:
break;
...
}
```

---
Expand Down

0 comments on commit c131910

Please sign in to comment.