Comment by neonsunset
1 year ago
> For example last night I was trying to do something with C# generics and it confidently told me I could use pattern matching on the type in a switch statwmnt, and threw out some convincing looking code.
Just use it on an instance instead
var res = thing switch {
OtherThing ot => …,
int num => …,
string s => …,
_ => …
};
No comments yet
Contribute on Hacker News ↗