Skip to content

Instantly share code, notes, and snippets.

@jsonmez
Created May 15, 2014 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsonmez/7dbfaaeec35a4520fa6c to your computer and use it in GitHub Desktop.
Save jsonmez/7dbfaaeec35a4520fa6c to your computer and use it in GitHub Desktop.
Using reasonable defaults and optional parameters
public void LoginAsCustomer(LoginInfo loginInfo, CustomerType customerType = CustomerType.NEW_CUSTOMER, int numberOfTries = 3)
{
// ...
}
var loginInfo = new LoginInfo("Darth Vader", "ihatewookes");
LoginAsCustomer(loginInfo);
// What if we need to override a default? No problem.
LoginAsCustomer(loginInfo, customerType: CustomerType.REWARDS_CUSTOMER);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment