Is there a ToString() generator available in Visual Studio 2010?

前端 未结 11 838
伪装坚强ぢ
伪装坚强ぢ 2021-01-03 17:39

Is there any way to generate a ToString() using Visual Studio 2010?

I really don\'t want to do this by hand!

[EDIT]

I\'m looking for a s

11条回答
  •  我在风中等你
    2021-01-03 18:34

    If you need better representation of your object while debugging you can use the DebuggerDisplayAttribute:

    [DebuggerDisplay("Count = {count}")]
    class MyHashtable
    {
        public int count = 4;
    }
    

    This can be quicker than overriding ToString, but it still doesn't let you choose fields, you have to type them.

提交回复
热议问题