For example you have following class:
public class Person
{
public Person(string firstName, string lastName)
{
_firstName = firstName;
_lastName = lastName;
}
private string _firstName;
private string _lastName;
}
Debugger watch window is going to show you:
YouNamespace.Person.
However if you declare your class this way:
[DebuggerDisplay("{ToString()}")]
public class Person
{
public Person(string firstName,string lastName)
{
_firstName = firstName;
_lastName = lastName;
}
public override string ToString()
{
return string.Concat(_firstName, " ", _lastName);
}
private string _firstName;
private string _lastName;
}
And check result of:
Person p = new Person("Viktar", "Karpach");
You are going to see in dubugger watch window that p has value Viktar Karpach.