How to make [DebuggerDisplay] respect inherited classes or at least work with collections?

后端 未结 3 573
名媛妹妹
名媛妹妹 2020-12-31 07:21

I\'ve got a class which inherits from a List. It works well and as expected in all respects except one: when I add the [DebuggerDisplay]<

3条回答
  •  青春惊慌失措
    2020-12-31 07:58

    Use the DebuggerDisplay attribute like so:

    [DebuggerDisplay("ID:{ID},Customers:{Customers==null?(int?)null:Customers.Count}")]`
    class Project
    {
        int ID{get;set;}
        IList Customers{get;set;}
    }
    

    Some more info here.

提交回复
热议问题