5
[C# 10] How to use declaration patterns with a switch statement?
(programming.dev)
An integer will never be a string. Originally you create an integer variable so it's telling you the string case is pointless.
Your code does not follow the pattern matching syntax; I don't see "is" anywhere. That's what is actually doing the casting
Edit: I think I'm completely wrong about "is" being required
Getting started
Useful resources
IDEs and code editors
Tools
Rules
Related communities
Wikipedia pages