Need help with a C#, overload method

Is there anyway to make this working? I mean the second method? Its to similar for the compiler.. I cant see this shouldnt legit?

public void Event(string message, string userName)
{
timeDate = DateTime.Now;
objWriter.WriteLine("LoggId: {0} ; User: {1} ; Message: {2} ; {3}", this.logId++, userName, message, timeDate);
}

    private void Event(string message)
    {
      timeDate = DateTime.Now;
      objWriter.WriteLine("LoggId: {0} ; User: {1} ; Message: {2} ; {3}", this.logId++, this.userUnknown, message, timeDate);
    }

Best Regards

The two methods you are declaring cannot be overloaded since one is declared public and the other is declared as private. The compiler disallows this since it normally does not make sense to have one method with public access and an overloaded version of this methods to be private.

1 Like

Hello sir!
Nah i tryd stuff like that, found a thread on stackoverflow, with a good respons: "The compiler cant know wich of the strings you want to passt something something.. thats why its gets compile erreor..

best regards!

PS ended up creating another method.. hehe