What's the difference between myVar
and myVar:
in VS auto-complete list while working with functions. Why the second one is added to this list ?
C# 4.0 introduced named arguments. This feature allows you to identify method arguments by their names instead of their position:
public void Foo(int bar, string quux)
{
}
// Before C# 4.0:
Foo(42, "text");
// After C# 4.0:
Foo(bar: 42, quux: "text");
// Or, equivalently:
Foo(quux: "text", bar: 42);
Intellisense has been updated to support that feature, that's why its autocompletion mechanism now offers both choices when a symbol accessible from the current scope has the same name as a method argument.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With