Points to remember while setting debugger display:
- Debugger identifies only the Property name placed inside the curly brace {Property}.
- Example: {Name}={PropertyName}.
- Nested Class Example : {ClassName.PropertyName}={Product.Name}.
Step 1: Namespaces used:
using System;
using System.Diagnostics;
Step 2: Usage:
protected void Page_Load(object sender, EventArgs e)
{
Book book = new Book();
book.Name = "Practical Demo";
book.Title = "CSharp";
book.Register = DateTime.Today;
Product product=new Product();
product.Name = "Programming";
book.Product = product;
namespace SampleApplication.New
{
public partial class DebuggerDisplatClass : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Book book = new Book();
book.Name = "Practical Demo";
book.Title = "CSharp";
book.Register = DateTime.Today;
Product product=new Product();
product.Name = "Programming";
book.Product = product;
}
}
[DebuggerDisplay("BookTitle{Title}-- {Name} , {Register}--{Product.Name}")]
public class Book
{
public string Title;
public DateTime Register;
public string Name;
public Product Product;
}
[DebuggerDisplay("ProductName{Name}")]
public class Product
{
public string Name;
}
}
Thanks for reading this article.