What the diffirence between C# and VB.net?

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

    What the diffirence between C# and VB.net?



    --
    ----------------
    Simon Peng
    xqpeng@tsinghua .org.cn


  • Manish Agarwal

    #2
    Re: What the diffirence between C# and VB.net?

    There are some differences between VB.NET and C#

    VB.NET doesn't support operator overloading.
    VB.NET doesn't support define #region within a method body.
    VB.NET doesn't support indexer.
    etc.

    look for details



    -------------------------
    "Manish Agarwal"- <manishkrishan@ hotmail.com>

    If replying to the group, please do not mail me.


    "Simon Peng" <xqpeng@tsinghu a.org.cn> wrote in message
    news:#FLoRktaDH A.3444@tk2msftn gp13.phx.gbl...[color=blue]
    >
    >
    > --
    > ----------------
    > Simon Peng
    > xqpeng@tsinghua .org.cn
    >
    >[/color]


    Comment

    • Mattias Sjögren

      #3
      Re: What the diffirence between C# and VB.net?

      Manish,
      [color=blue]
      >VB.NET doesn't support indexer.[/color]

      Sure it does.



      Mattias

      --
      Mattias Sjögren [MVP] mattias @ mvps.org

      Please reply only to the newsgroup.

      Comment

      • Frank Drebin

        #4
        Re: What the diffirence between C# and VB.net?

        One is full of assumptions and bugs waiting to happen and the other other is
        very anal/strict/less-bug-prone... :o)


        "Fergus Cooney" <wollus@tesco.n et> wrote in message
        news:OS1X2MzaDH A.2256@TK2MSFTN GP10.phx.gbl...[color=blue]
        > Hi Simon,
        >
        > One's Brilliant!!, the other's Great!!
        >
        > Yours [unhelpfully :-)]
        > Fergus
        >
        >[/color]


        Comment

        • Michael Mayer

          #5
          Re: What the diffirence between C# and VB.net?

          I believe the syntax in VB.NET is "Default Property" as opposed to indexer,
          but it's the same thing:
          Default Property Item(ByVal index as Integer) As String


          --
          Mike Mayer
          一区二区国产在线观看,日本欧美一区二区三区免费不卡,国产在线视频欧美一区二区,国产精品91久久久,影音先锋在最新资源站,实拍外国综艺节目三级,8x8x精品一区二区,国产黄色网站导航

          mike@mag37.com


          "Mattias Sjögren" <mattias.dont.w ant.spam@mvps.o rg> wrote in message
          news:O$VoffvaDH A.1832@TK2MSFTN GP09.phx.gbl...[color=blue]
          > Manish,
          >[color=green]
          > >VB.NET doesn't support indexer.[/color]
          >
          > Sure it does.
          >
          >
          >
          > Mattias
          >
          > --
          > Mattias Sjögren [MVP] mattias @ mvps.org
          > http://www.msjogren.net/dotnet/
          > Please reply only to the newsgroup.[/color]


          Comment

          • Michael Mayer

            #6
            Re: What the diffirence between C# and VB.net?

            In a nutshell, I believe VB.NET to be for a) supporting legacy VB 6 users,
            and b) for rapid-application development. In versions 2002-03 of VS, I
            don't see many differences in RAD between VB.NET and C#, but I believe the
            next versions of the IDE will reflect a bigger difference. (Microsoft says
            vb is for task-based programming, while c# is for code-based programming,
            whatever that means. I only write code to perform tasks!). What I think
            it means is that while the C# team worked on generics, the vb.net team
            brought back edit & continue, and added some really cool error-checking as
            you code. (Almost like ms word's grammar & spelling check as you type). I
            already think the VB.NET IDE is much better than the C# IDE, and it is
            advancing further ahead.

            In addition to operator overloading and the #region within a method body
            (which I didn't realize to be a difference, nor do I think to be a very good
            idea), here are some other differences:

            1. C# by default supports XML comments (there are currently plugins for
            VB.NET xml comments, and the next version will support it natively). This
            is a huge plus for C# at the moment - especially when combined with ndoc.

            2. VB.NET has a simpler syntax for some event handlers (especially useful
            for GUIs) since they have the keyword "handles"
            e.g.
            MySub(Object sender, EventArgs e) Handles Button1.Clicked
            blah blah
            End Sub
            no need for a line Button1.Clicked += new EventHandler(My Sub)

            3. VB.NET is a bit more verbose in other ways, using End Sub instead of
            just } - note that the IDE generally provides the End Sub / End Fucntion /
            End If automagically as soon as you start a block, so you probably type
            about the same amount. Implementing properties in vb.net is really easy
            with the ide - it adds the get/set methods as soon as you type the property
            declartion.

            4. Case sensitivity - VB.NET isn't case sensitive. This has it's advantages
            and disadvantages. I like this for RAD because as I'm typing (all
            lowercase) I can see it automatically recase to ProperPascalCas e or
            camelCase. If it doesn't recase, it means I misspelled something. I don't
            like the case insensitivity because I like to use case to define scope. For
            instance, a public property named Color may use a private variable color,
            both of type Color. In VB.NET, you're forced to name the private variable
            something else, like myColor or m_Color.

            5. VB.NET has support for some "archaic" vb things that you probably
            shouldn't be using in new code, but that might be useful for portability.
            The terrible "On Error Resume" and such is still available in VB.NET. Also
            ReDim Preserve for resizing arrays and preserving the contents (which just
            copies the array contents to a new array, I believe, but the syntax *may* be
            cleaner). VB.NET can also define arrays to have non 0 based indices, but
            these are strongly discouraged. There's an entire dll of vb things (which
            are also available in C# if you need them) specifically for legacy code.

            6. VB.NET has an Option Strict On/Off which changes how typesafe the
            compiler forces you to be. (C# is always quite typesafe)

            7. VB.NET supports optional arguments on methods.

            8. C# supports unsigned integer types (you can't add two unsigned ints in
            VB.NET, for instance).

            9. C# supports "unsafe" code, i.e. you can still use pointers if you need.
            (really useful for image manipulation).

            10. ; in C# - which is REALLY NICE. Otherwise, in VB.NET, you have to use
            _ when a statement runs over the end of a line, which seems to make my VB
            code have really long lines that go past the end of the screen and makes the
            code much harder to read.

            11. The VB.NET IDE is much nicer. Especially for intellisense, trying to
            override base class methods, and adding event handlers. And the
            error-reporting as you code is way ahead in VB.NET.

            12. Possible difference in salary of a developer (historically C++ paid more
            than VB, not sure where C# will fall in the spectrum).

            13. Future differences: C# will support generics, don't think VB.NET will
            (soon anyways)

            Finally, and probably the most important of all: C# is more familiar for
            anybody who has a C/C++/Java background. VB.NET is more familiar for
            anybody who has a VB background. Pick the one that fits either your past
            experience or future plans (do you want to be a Java/.NET developer, C# is
            probably better. Do you come from a history of VB6 / COM programming?
            VB.NET will probably be better). They both have access to the entire FCL
            (Framework Class Library) so things like opening a file, reading its
            contents, performing a regular expression replace on the contents, and
            posting the results to a web page will be virtually identical between the
            two languages.

            --
            Mike Mayer
            一区二区国产在线观看,日本欧美一区二区三区免费不卡,国产在线视频欧美一区二区,国产精品91久久久,影音先锋在最新资源站,实拍外国综艺节目三级,8x8x精品一区二区,国产黄色网站导航

            mike@mag37.com


            Comment

            • Jon Skeet

              #7
              Re: What the diffirence between C# and VB.net?

              Michael Mayer <mike@mag37.com > wrote:[color=blue]
              > 13. Future differences: C# will support generics, don't think VB.NET will
              > (soon anyways)[/color]

              I believe it'll have it in the same release that C# does. From
              Learn with interactive lessons and technical documentation, earn professional development hours and certifications, and connect with the community.


              <quote>
              Finally, for the more advanced Visual Basic developer, language
              enhancements include support for operator overloading, unsigned data
              types, inline XML-based code documentation, and partial types. In
              addition, developers using Visual Basic will have access to a type-
              safe, high-performance, compile time-verified version of generics that
              promote code reuse across a variety of data types.
              </quote>

              --
              Jon Skeet - <skeet@pobox.co m>
              Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

              If replying to the group, please do not mail me too

              Comment

              • Michael Mayer

                #8
                Re: What the diffirence between C# and VB.net?

                "Jon Skeet" <skeet@pobox.co m> wrote in message
                news:MPG.19b511 c2a13a68598a388 @news.microsoft .com...[color=blue]
                > Michael Mayer <mike@mag37.com > wrote:[color=green]
                > > 13. Future differences: C# will support generics, don't think VB.NET[/color][/color]
                will[color=blue][color=green]
                > > (soon anyways)[/color]
                >
                > I believe it'll have it in the same release that C# does. From
                > http://msdn.microsoft.com/vstudio/pr...p.aspx#whidbey
                >
                > <quote>
                > Finally, for the more advanced Visual Basic developer, language
                > enhancements include support for operator overloading, unsigned data
                > types, inline XML-based code documentation, and partial types. In
                > addition, developers using Visual Basic will have access to a type-
                > safe, high-performance, compile time-verified version of generics that
                > promote code reuse across a variety of data types.
                > </quote>[/color]

                Wow, that's outstanding. Didn't realize they were adding so much of that -
                I even read that article, but I must have skipped that paragraph. I might
                be tempted to go back to VB.NET (that was my first exposure to .NET before I
                discovered C#). I would miss {}'s and ;'s since my "real" background is
                C++.

                Wonder if they'll have the new iterators as well? I didn't see that
                mentioned in the article.

                mike


                Comment

                Working...