I have this method
public static void WriteErrorLog(LogEntry logEntry, string method, [Optional, DefaultParameterValue(0)] int? errorTypeID)
So I expect that I can call the method like
WriteErrorLog(l, "text");
But I get an error of Visual Studio anyway 🙁
No overload for method ‘WriteErrorLog’ takes 2 arguments
What I am missing?
Thank you!
You’re not supposed to be using
[Optional, DefaultParameterValue(0)]. Instead, you should use the c-style default parameter syntax:Also, if
errorTypeIdis aNullable, then shouldn’t you have the default value benull?