Is there any way for the nameof operator to access method parameters (outside of the same method)?
No. There is no way to get the parameter names from the outside of the method using nameof. nameof doesn’t work for method parameters if you want the name on the calling side (for the callee it does work obviously). The other methods you mentioned, like reflection, do work. var parameterNames = typeof(Program) .GetMethod(nameof(Program.Main)).GetParameters() .Select(p … Read more