I have been gone into a project (written in advance) that has some kind of different usage for parameters that I have never seen before. So I wanted to learn what is the difference between these two ?
public string Login(string Email, string Password)
{
Member member = MemberProvider.Instance.Login(Email: Email, Password: Password);
// more implementation
}
vs
public string Login(string Email, string Password)
{
Member member = MemberProvider.Instance.Login(Email, Password);
// more implementation
}
Thanks in advance,
The first usage is using named arguments, whereas the second is using the ordinary “put the argument in the correct spot in the parameter list” usage.
The former style means that you can put the arguments in any order you like, and so you don’t have to remember (or care) what order the function signature actually has them. You associate each argument with a parameter name, and the function receives the arguments correctly.
Both styles do the exact same thing, though. The former is a convenience added with C# 4.