PC Review


Reply
Thread Tools Rate Thread

C# ide VS. VB ide

 
 
cj
Guest
Posts: n/a
 
      24th Jun 2008
I just stated writing some C# code and I notice it doesn't seem to go
back and correct indentation etc like it does in VB. I kinda liked that
in VB. If I removed an if else block it would reindent the code etc.
Is that something I can turn on or is it just not done in C#?
 
Reply With Quote
 
 
 
 
Morten Wennevik [C# MVP]
Guest
Posts: n/a
 
      24th Jun 2008
Hi,

No, this feature does not exist in C#. This is by design. To readjust
indentation you have to delete/add an end block } or end statement ; at a
higher level.

--
Happy Coding!
Morten Wennevik [C# MVP]


"cj" wrote:

> I just stated writing some C# code and I notice it doesn't seem to go
> back and correct indentation etc like it does in VB. I kinda liked that
> in VB. If I removed an if else block it would reindent the code etc.
> Is that something I can turn on or is it just not done in C#?
>

 
Reply With Quote
 
Tommy Holm Jakobsen
Guest
Posts: n/a
 
      24th Jun 2008
Hi.
I'm not sure that I understand your problem but if you are using Visual
Studio, you can reformat the whole document by pressing (CTRL+E, D) or
(CTRL+K, D).

Kind regards,
Tommy

cj wrote:
> I just stated writing some C# code and I notice it doesn't seem to go
> back and correct indentation etc like it does in VB. I kinda liked
> that in VB. If I removed an if else block it would reindent the code
> etc. Is that something I can turn on or is it just not done in C#?

 
Reply With Quote
 
Mick Wilson
Guest
Posts: n/a
 
      24th Jun 2008
On Jun 24, 9:32*am, cj <c...@nospam.nospam> wrote:
> I just stated writing some C# code and I notice it doesn't seem to go
> back and correct indentation etc like it does in VB. *I kinda liked that
> in VB. *If I removed an if else block it would reindent the code etc.
> Is that something I can turn on or is it just not done in C#?


I don't know of a setting that does this, but there's a keyboard chord
that will do pretty much the same thing. As long as your code can be
parsed, you can hit ctrl-k -> ctrl-f to reformat whatever you have
selected. I often hit ctrl-a beforehand to do the whole file.

I prefer this to VB's autoformat. I've noticed sometimes that when vb
does its autoformatting trick, each of the indents/unindents are put
into the editor's undo history. Now, if want to ctrl-z over my last
few code changes, I have to back up over each of the formatting
changes that were put in. What I mentioned above might function the
same way (I've never noticed this problem in C#), but I at least have
more control over when I want it to happen.
 
Reply With Quote
 
Ignacio Machin ( .NET/ C# MVP )
Guest
Posts: n/a
 
      24th Jun 2008
On Jun 24, 9:32*am, cj <c...@nospam.nospam> wrote:
> I just stated writing some C# code and I notice it doesn't seem to go
> back and correct indentation etc like it does in VB. *I kinda liked that
> in VB. *If I removed an if else block it would reindent the code etc.
> Is that something I can turn on or is it just not done in C#?


you can reformat the document using Ctrol K + Control D
 
Reply With Quote
 
cj
Guest
Posts: n/a
 
      24th Jun 2008
Thanks everyone.

cj wrote:
> I just stated writing some C# code and I notice it doesn't seem to go
> back and correct indentation etc like it does in VB. I kinda liked that
> in VB. If I removed an if else block it would reindent the code etc. Is
> that something I can turn on or is it just not done in C#?

 
Reply With Quote
 
DeveloperX
Guest
Posts: n/a
 
      24th Jun 2008
On 24 Jun, 19:51, cj <c...@nospam.nospam> wrote:
> Thanks everyone.
>
>
>
> cj wrote:
> > I just stated writing some C# code and I notice it doesn't seem to go
> > back and correct indentation etc like it does in VB. *I kinda liked that
> > in VB. *If I removed an if else block it would reindent the code etc.Is
> > that something I can turn on or is it just not done in C#?


Also consider Resharper. It's an add in that pays for itself in about
four minutes. I don't think I want to use VS without it again
 
Reply With Quote
 
Man T
Guest
Posts: n/a
 
      26th Jun 2008
>you can reformat the document using Ctrol K + Control D

Sorry, what do you mean by
Control K + Control D?

Is that
Control + K
then
Control + D ?


 
Reply With Quote
 
cj2
Guest
Posts: n/a
 
      27th Jun 2008
So is their a menu way to do this? What does Control K do? Then
Control D? I mean is this just a complicated shortcut or does Control K
tell it select everything and Control D tell it to reformat or ..... I
don't see any menu items that list that combo and I don't see any that
list only ctrl k or ctrl d



Man T wrote:
>> you can reformat the document using Ctrol K + Control D

>
> Sorry, what do you mean by
> Control K + Control D?
>
> Is that
> Control + K
> then
> Control + D ?
>
>

 
Reply With Quote
 
Αντώνης
Guest
Posts: n/a
 
      27th Jun 2008
Why don't you try it to see what does it do? In any case, this is
equivalent to CTRL + E, CTRL + D (Edit > Advanced > Format Document).
In addition:

Edit.FormatDocument
CTRL + K, CTRL + D
Applies the indenting and space formatting for the language as specified
on the Formatting pane of the language in the Text Editor section of the
Options dialog box.
(ms-help://MS.VSCC.v90/MS.msdnexpress.v90.en/dv_vssettings/html/754340bc-2db6-49c3-9de9-2deb008c1477.htm)



O/H cj2 *γραψε:
> So is their a menu way to do this? What does Control K do? Then
> Control D? I mean is this just a complicated shortcut or does Control K
> tell it select everything and Control D tell it to reformat or ..... I
> don't see any menu items that list that combo and I don't see any that
> list only ctrl k or ctrl d
>
>
>
> Man T wrote:
>>> you can reformat the document using Ctrol K + Control D

>>
>> Sorry, what do you mean by
>> Control K + Control D?
>>
>> Is that
>> Control + K
>> then
>> Control + D ?
>>


--
_____________________________________________________________
B&D Technologies
http://www.bd-tech.com
Antoni Biliardis - antoni(at)bd-tech.com
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:39 AM.