Optional C# parameter issue

c#

Solution

You're not supposed to be using `[Optional, DefaultParameterValue(0)]`. Instead, you should use the c-style default parameter syntax:

public static void WriteErrorLog(LogEntry logEntry, string method, int? errorTypeID = 0)

Also, if `errorTypeId` is a `Nullable`, then shouldn't you have the default value be `null`?

public static void WriteErrorLog(LogEntry logEntry, string method, int? errorTypeID = null)

Problem

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!

Original source