Named arguments and optional parameters
suggest changeYou can combine named arguments with optional parameters.
Look at 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 setting the retryCount argument:
var result = SmsUtil.SendMessage(
from : "Cihan",
to : "Yakar",
message : "Hello there!",
attachment : new object());
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents