Having
public static void Search(string name, int age = 21, string city = "Tehran")
{
MessageBox.Show(String.Format("Name = {0} - Age = {1} - City = {2}",
name, age, city));
}
I want to call Search method using name and city parameters to keep the default value of age.
AFAIK parameter should be referred by name
Search("Mahdi", city: "Mashhad");
I want to know if it is possible to make the call without specifying value for age and also without calling city by name? I mean something like jumping over a parameter, something like :
or
Search("Mahdi",,"Mashhad");
I've seen almost similar behavior for for
loop
for (int i = 0; ; i++) { some code; }
or any other syntax that matches the case?