ASMX HTTP Get Parameter is a C # keyword

I am using asp.net 2 and should use a third-party HTTP GET call that includes a parameter called interface

I created an asmx file and have a function like

 [WebMethod] [ScriptMethod(UseHttpGet = true)] public void Test(string interface) { } 

However, this is a compilation error because interface is a C # keyword and therefore will not allow me to create a variable with a name that.

Is there any way to solve this problem?

+4
source share
1 answer

Add interface with @ symbol

 [WebMethod] [ScriptMethod(UseHttpGet = true)] public void Test(string @interface) 

However, this should be done only when absolutely necessary , and this should be avoided, if at all possible.

+6
source

Source: https://habr.com/ru/post/1403536/


All Articles