You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicvoidTestMethod(intsomeValue,doublesomeOtherValue){// this worksstringname=nameof(someValue);}
Now I would love to use nameof onto a parameter from outside the method.
I propose the following syntax.
publicvoidAntherTestMethod(){// I want THIS to work// if my methods are in the same classstringnameOfParam1InTestMethod=nameof(TestMethod.someValue);// if they are in other classes, add the class name infront of itstringnameOfAParamInAnotherClass=nameof(TheClass.TestMethod.someOtherValue);}
If this is not clear enough, another idea would be ClassName.MethodName.params.paramName
So the params keyword to access the params of a method.
Where is this useful?
This would be especially useful in Web/using ASP.NET when you have to specify the name of a parameter of a method as a string. With this change I would be able to adress them in a compile time and refoctoring safe way. If the param name changes, I'll notice.
The text was updated successfully, but these errors were encountered:
@Mafii would you mind closing this issue, since some discussion already happened at #373 ? Also some effort has gone into discussing overloads there. There's no point in duplicating issues i think.
Consider the following method:
Now I would love to use nameof onto a parameter from outside the method.
I propose the following syntax.
If this is not clear enough, another idea would be
ClassName.MethodName.params.paramName
So the
params
keyword to access the params of a method.Where is this useful?
This would be especially useful in Web/using ASP.NET when you have to specify the name of a parameter of a method as a string. With this change I would be able to adress them in a compile time and refoctoring safe way. If the param name changes, I'll notice.
The text was updated successfully, but these errors were encountered: