Have you ever pass wrong parameter values to a method because:
- The method has too many parameters
- There are also default values for parameters
- There are many overrides
Of course Visual Studio let you know when you pass wrong type, but not for the same type.
Let's see the simplest example.
using System;
namespace SampleConsoleApp
{
class Program
{
static void Main(string[] args)
{
var me = new Person("kenichiro", "nakamura");
Console.WriteLine($"Hello {me.Firstname} {me.Lastname}");
}
}
class Person
{
public string Firstname { get; set; }
public string Lastname { get; set; }
public Person(string firstname, string lastname)
{
this.Firstname = firstname;
this.Lastname = lastname;
}
}
}
When I write code, Visual Studio helps me by showing parameter name.
However, after I finish entering values, now I don't see any hint.
Enable Experimental Feature
The latest Visual Studio 2019 has following option.
Once you enable it, you can see parameter names like this.
Of course, the official document has this information here
Who need this feature?
I do. But it's not required for everyone, every time. There was a discussion in GitHub issue which suggest some improvements and re-consideration.
So I recommend you to try out first, then if it bothers you, you can turn it off anytime without restarting your VS 2019.
Top comments (0)