I’m trying to use
public static string TryGetRequestValue(this HttpRequest stringArg, int maxLengthArg)
{
return null;
}
As an extension method and it isn’t working I get the error message ‘No overload for method TryGetRequestValue’ etc etc…
However when I take out the HttpRequest arg and change it to a string it works….Why is this?
Any help much appreciated.
See my comment under the question, but based on this statement:
The first parameter in an extension method – the one prefixed with
this– determines the type being extended. So the expected way to call this method would be:The method returns a
string, and only takes one parameter:maxLengthArg.Apologies if you already know this much – posting the code that’s throwing the exception, as well as the exception itself, will make that clearer.