Named arguments and optional paramaters

suggest change

You can combine named arguments with optional parameters.

Let see this method:

public sealed class SmsUtil
{
    public static bool SendMessage(string from, string to, string message, int retryCount = 5, object attachment = null)
    {
         // Some code
    }
}

When you want to call this method without set retryCount argument :

var result = SmsUtil.SendMessage(
                            from       : "Cihan",
                            to         : "Yakar",
                            message    : "Hello there!",
                            attachment : new object());

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents