I have to say this is one of my favorite features added to this new version. I don’t know how many times I have gone into method overload madness because C# has never supported optional parameters. VB.Net always has…why not C#? Well, now it does!
public void AddUser(string firstName, string lastName, string status = "New User") {User = new User(firstName, lastName, status);}
Now this method could be called in a few ways:
AddUser("Sean", "Jaeger", "Working right now");AddUser("Sean", "Jaeger");AddUser(lastName: "Jaeger", firstName: "Sean");
Pretty darn cool!
0 comments:
Post a Comment