leetcode is using C# language version 7.2.
Version 7.3 of C# adds ref reassignment - a useful feature for some solutions.
For example, the C# solution to Swap Nodes in Pairs can look very much like a good C++ solution if you can reassign ref locals.