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

Categories

0 votes
116 views
in Technique[技术] by (71.8m points)

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

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)

question from:https://stackoverflow.com/questions/4932136/is-there-a-tostring-generator-available-in-visual-studio-2010

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

1 Answer

0 votes
by (71.8m points)

You can create your own custom snippet for every boilerplate code and access it from IntelliSence
Here is a good tutorial http://msdn.microsoft.com/en-us/library/ms165392.aspx

Have a good look at how to create snippets with replacements. You can create quite generic structures.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...