Combining CallerMemberName with params

You could do something like this:

protected static object[] Args(params object[] args)
{
    return args;
}

protected void Log(string message, object[] args = null, [CallerMemberName] string method = "")
{
    // Log
}

To use the log do like this:

Log("My formatted message a1 = {0}, a2 = {2}", Args(10, "Nice"));

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)