auto-format feature available in C#

one thing I like better about VB.NET over C#.net is that VB.NET will auto-format your code for you, adding capitalization and indentation.

Is this feature available in C#? (capitilization is not of course because C# is case sensitive, but indentation, and other auto-formating  would be nice in order to same me some work)

if it is not available in VS 2003, is it available in VS 2005?

thx

-brokeMyLegBiking
LVL 4
brokeMyLegBikingAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlexFMCommented:
This is already available in C# 2003, possibly you need to change Visual Studio settings. See: Tools - Options - Text Editor - C# - Formatting.
cupawntaeCommented:
Try selecting the code you want to reformat (ctrl-A to select the whole file), then ctrl-K ctrl-F (= Edit->Advanced->Format Selection).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
brokeMyLegBikingAuthor Commented:
ok, cool. so you have to press these keys every time you want it to auto-format, there is no way for it to trigger when I press return or hit a ";"  ?

that is helpful. I wish it were more automatic
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Zamba1Commented:
The VS.NET 2003 editor does not "pretty" any C# code and there is no option for this you could turn on.

Don't know about the 2005 editor.
Zamba1Commented:
Edit: This applies to "capitalization" only - indentation works like [cupawntae] wrote.
cupawntaeCommented:
The only "automatic" feature (to my knowledge) is code completion. E.g. if you type some of a method name and press <ctrl-space> it will complete the name (sometimes with various options listed). In this case, it *will* fix capitalization for you.

E.g. type varName.tostr<ctrl-space> and it'll change to varName.ToString

I find this very useful being a java programmer "in real life", because the capitalization is similar but annoyingly different...

Oh and <tab> works in most cases for completion too...
cupawntaeCommented:
Actually, I forgot there are actually two more auto-format features, listed in the settings mentioned by AlexFM...

Firstly, when you close a block (i.e. type a '}') it can reformat the code inside the block.

Secondly, it can reformat code that you paste in from another file.

Doesn't do what you're looking for but worth a mention!
brokeMyLegBikingAuthor Commented:
ok, thx, that is good to know.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.