Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)

like image 853
laura Avatar asked Feb 08 '11 10:02

laura


People also ask

What is ToString in Visual Basic?

ToString(Single, NumberFormatInfo) Converts a Single value to a String value, using the specified number format.


1 Answers

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.

like image 84
tster Avatar answered Sep 20 '22 21:09

tster