Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 simple string representation of my model. In previous IDEs * ToString generation has been enabled in the UI using simple templates and field selection.

Currently default implementations of Equals and Hashcode are offered in a similar pattern. I'd hoped there was something similar for ToString.

It seems not by default - thanks for the responses!

(* this is my first .net project)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
188 views
Welcome To Ask or Share your Answers For Others

1 Answer

Resharper supports this by generating "formatting members"

https://www.jetbrains.com/resharper/webhelp/Code_Generation__Formatting_Members.html

Resharper -> Edit -> Generate Code -> Formatting Members

or

alt + insert -> Formatting Members

I confirmed this is available in Resharper 8.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...