C# ide VS. VB ide

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cj

    C# ide VS. VB ide

    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#?
  • =?Utf-8?B?TW9ydGVuIFdlbm5ldmlrIFtDIyBNVlBd?=

    #2
    RE: C# ide VS. VB ide

    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#?
    >

    Comment

    • Mick Wilson

      #3
      Re: C# ide VS. VB ide

      On Jun 24, 9:32 am, cj <c...@nospam.no spamwrote:
      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.

      Comment

      • Tommy Holm Jakobsen

        #4
        Re: C# ide VS. VB ide

        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#?

        Comment

        • Ignacio Machin ( .NET/ C# MVP )

          #5
          Re: C# ide VS. VB ide

          On Jun 24, 9:32 am, cj <c...@nospam.no spamwrote:
          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

          Comment

          • cj

            #6
            Re: C# ide VS. VB ide

            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#?

            Comment

            • DeveloperX

              #7
              Re: C# ide VS. VB ide

              On 24 Jun, 19:51, cj <c...@nospam.no spamwrote:
              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 :)

              Comment

              • Man T

                #8
                Re: C# ide VS. VB ide

                >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 ?


                Comment

                Working...