VB.NET or C#.NET ???

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

    #61
    Re: VB.NET or C#.NET ???

    In addition, although this is not something that should be done very often,
    it allows one to put multiple statements on the same line, and thus compact
    your code a bit. There are a few situations where this comes in handy, such
    as in switch statements.

    switch (foo)
    {
    case (1): someFunction(); break;
    case (2): SomeOtherFuncti on(); break;
    //...
    }

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    We got a sick zebra a hat,
    you ultimate tuna.


    "Jon Skeet [C# MVP]" <skeet@pobox.co m> wrote in message
    news:MPG.1e5b9a cbdb5fbdb798ce2 f@msnews.micros oft.com...[color=blue]
    > Michael D. Ober <obermd.@.alum. mit.edu.nospam> wrote:[color=green]
    >> In C and C# you must use a semi-colon to indicate the end of a statement.
    >> This allows statements to continue across multiple lines without a
    >> continuation character. In VB, statements are only one line long unless
    >> they have a continuation character. Both languages support multiple
    >> statements on a single line - C# via adding a statement after the
    >> semi-colon
    >> and VB by adding a colon between statements. This is a syntax issue
    >> only,
    >> but it plays directly into readability of the language. Which one you
    >> like
    >> depends on your preferences.[/color]
    >
    > Absolutely. There are definitely swings and roundabouts. As an
    > anonymous poster wrote, there are far more lines *without*
    > continuations than ones *with* - but then again, not being quite as
    > white-space sensitive makes it easier to cut and paste code in C#, and
    > encourages lines to be wrapped more often. (i.e. in VB.NET there's more
    > of a temptation to try to get a statement onto one line so as to avoid
    > the continuation character. Not much more, but a little bit...)
    >
    > --
    > Jon Skeet - <skeet@pobox.co m>
    > http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
    > If replying to the group, please do not mail me too[/color]


    Comment

    • Carlos J. Quintero [VB MVP]

      #62
      Re: VB.NET or C#.NET ???

      "Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us >
      escribió en el mensaje news:e793soLMGH A.916@TK2MSFTNG P10.phx.gbl...[color=blue]
      > I would suggest the opposite, start with C# , it will be a slower start
      > but you will not "inherit" the bad habits you adquire using VBA , you
      > start freshly with a complete new set of concepts and way to write code.
      > I have seen a good amount of VERY BAD VB.NET code that scream it was
      > written by somebody who changed from VB6 to VB.NET in a similar way that
      > when they changed from VB5 to VB6[/color]

      The bad habits are not attached to the language (at least most of them), but
      to the programmer, and they will be carried to any new language. Even if
      they are not bad habits but just ignorance, say, not using inheritance
      because it did not exist in VBA/VB6, he will not be using it just because of
      choosing C# and not VB.NET.

      --

      Best regards,

      Carlos J. Quintero

      MZ-Tools: Productivity add-ins for Visual Studio
      You can code, design and document much faster:
      MZ-Tools has a single goal: To make your everyday programming life easier. As an add-in to several Integrated Development Environment (IDEs) from Microsoft, MZ-Tools adds new menus and toolbars to them that provide many new productivity features.




      Comment

      • Herfried K. Wagner [MVP]

        #63
        Re: VB.NET or C#.NET ???

        Kevin,

        "Kevin Spencer" <kevin@DIESPAMM ERSDIEtakempis. com> schrieb:[color=blue]
        > In addition, although this is not something that should be done very
        > often, it allows one to put multiple statements on the same line, and thus
        > compact your code a bit. There are a few situations where this comes in
        > handy, such as in switch statements.
        >
        > switch (foo)
        > {
        > case (1): someFunction(); break;
        > case (2): SomeOtherFuncti on(); break;
        > //...
        > }[/color]

        That's what VB.NET has the ':' for:

        \\\
        Bla() : Foo() : i = i + 12 : Goo(1, 2, 3)
        ///

        --
        M S Herfried K. Wagner
        M V P <URL:http://dotnet.mvps.org/>
        V B <URL:http://classicvb.org/petition/>

        Comment

        • Kevin Spencer

          #64
          Re: VB.NET or C#.NET ???

          Darn, Herfried, it's been so long I forgot! I must be getting rusty with my
          VB.Net!

          --
          HTH,

          Kevin Spencer
          Microsoft MVP
          ..Net Developer
          We got a sick zebra a hat,
          you ultimate tuna.


          "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
          news:Ob8jMtXMGH A.3728@tk2msftn gp13.phx.gbl...[color=blue]
          > Kevin,
          >
          > "Kevin Spencer" <kevin@DIESPAMM ERSDIEtakempis. com> schrieb:[color=green]
          >> In addition, although this is not something that should be done very
          >> often, it allows one to put multiple statements on the same line, and
          >> thus compact your code a bit. There are a few situations where this comes
          >> in handy, such as in switch statements.
          >>
          >> switch (foo)
          >> {
          >> case (1): someFunction(); break;
          >> case (2): SomeOtherFuncti on(); break;
          >> //...
          >> }[/color]
          >
          > That's what VB.NET has the ':' for:
          >
          > \\\
          > Bla() : Foo() : i = i + 12 : Goo(1, 2, 3)
          > ///
          >
          > --
          > M S Herfried K. Wagner
          > M V P <URL:http://dotnet.mvps.org/>
          > V B <URL:http://classicvb.org/petition/>[/color]


          Comment

          • Herfried K. Wagner [MVP]

            #65
            Re: VB.NET or C#.NET ???

            "Kevin Spencer" <kevin@DIESPAMM ERSDIEtakempis. com> schrieb:[color=blue]
            > Darn, Herfried, it's been so long I forgot! I must be getting rusty with
            > my VB.Net![/color]

            No problem. Personally I do not like the ':' statement separator ;-).

            --
            M S Herfried K. Wagner
            M V P <URL:http://dotnet.mvps.org/>
            V B <URL:http://classicvb.org/petition/>

            Comment

            Working...