none
How does C#.NET compare to VB.NET? RRS feed

  • Question

  • Hello all!  I’d like to know some pros and cons of C#.NET and better understand how it compares to VB.NET.  I’ve studied VB.NET for about 1 year.  I have been reading several 1,000+ page books on VB.NET and I have reading through discussion group posts on my own.  I have no formal classroom education and very little formal training…with the exception of developing one web site for a friend using ASP.NET and VB-code-behind.  I am now trying to teach myself C# (I’ve been at it for a couple months now).  I have been programming in VBA for 7 years.

     

    Basically, I’d like to know how C#.NET compares to VB.NET.  I’ve seen a couple web sites that literally convert VB.NET into C#.NET (and vice versa).  It seems like the syntax is similar, and it seems like the functionality is similar.   Am I right?  I am thinking of getting away from VB.Net and focusing just on C#.NET.  Again, I know VBA quite well and thus I fell like I don’t have to spend significant time learning VB.NET (which seems VERY similar).  Also, it seems like many employers want people with strong C#-skills, right.

     

    Can someone offer some tips, comments, suggestions, advice, etc.

     

    Thanks!!

    Ryan---

     

    Sunday, August 1, 2010 2:12 AM

Answers

  • Hi There,

    I have been using VB6  then VB.net and then C# since longtime.

    There are few things in each language which you can't do in other.

    But I enjoyed C# the most while programming. 

     

    Following is a brief comparison of C# and VB..

    http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Visual_Basic_.NET

    Here are quick lessons if you want to move from VB to C#..

    http://www.harding.edu/fmccown/vbnet_csharp_comparison.html


    Mubi | http://mrmubi.com | Mark The Best Replies As Answers!
    Sunday, August 1, 2010 9:26 AM
  • IMO

    They do the same.. Sure, one might have a few prebuilt libraries that the other doesnt, but that doesnt mean that it cant be done on either side.

    It's really about what you prefer, what you find easiest to code/read..

    I prefer C over VB, less wordy. But again, this is my opinion.

    • Marked as answer by ryguy72 Wednesday, October 17, 2012 7:02 PM
    Sunday, August 1, 2010 9:52 AM
  • For going to program in c# if you are good in vb then mind follow steps

    1. c# is case sensitive

    2. c# is strongly typed... means you have to convert types while assigning to different type

    3. statements end with semicolon ;

    4. no sub or function use public void x() for sub and public <returntype> x() for functions

    5. no optional parameters with function parameters

    6. shared replaced with static

     

    and lot of others for starting this is enough i suppose i more thing in the place of imports System like header command use using System;

    • Marked as answer by ryguy72 Wednesday, October 17, 2012 7:02 PM
    Sunday, August 1, 2010 10:10 AM
  •  
    "ryguy72" wrote in message news:24f36572-db25-42d5-b22c-c7a71285405a...

    Can someone offer some tips, comments, suggestions, advice, etc.

     

    My response -------------------------------------------------------------------------------------------------------

     

    It's not about VB or C# .NET, but rather, it's about this. If you know it, then it doesn't matter which one you use.

    What is Object-oriented-programming?

    (OOP) is a programming paradigm that uses "objects" and their interactions to design applications and computer programs.

    The key concepts of OOP are the following:

    Class  <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

    Object  <o:p></o:p>

    Instance  <o:p></o:p>

    Method  <o:p></o:p>

    Message passing  <o:p></o:p>

    Inheritance  <o:p></o:p>

    Abstraction  <o:p></o:p>

    Encapsulation  <o:p></o:p>

    Polymorphism  <o:p></o:p>

    Decoupling  <o:p></o:p>

    <o:p> </o:p>

    http://en.wikipedia.org/wiki/Object-oriented_programming

    No matter what development platform Java,  .Net or others  OOP is OOP.

    http://math.hws.edu/eck/cs124/downloads/OOP2_from_Univ_KwaZulu-Natal.pdf

    What are design patterns?

    Design patterns are recurring solutions to software design problems you find again and again in real-world application development. Patterns are about design and interaction of objects, as well as providing a communication platform concerning elegant, reusable solutions to commonly encountered programming challenges.

    http://www.developer.com/design/article.php/1502691

    http://www.dofactory.com/Patterns/Patterns.aspx

     

    What is Domain Driven Design?

    (DDD) is an approach to the design of software, based on the two premises

    that complex domain designs should be based on a model, and that, for most software projects, the primary focus should be on the domain and domain logic (as opposed to being the particular technology used to implement the system).

    http://en.wikipedia.org/wiki/Domain-driven_design

     

    What is Test Driven Design?

    (TDD) is a software development technique that uses short development iterations based on pre-written test cases that define desired improvements or new functions. Each iteration produces code necessary to pass that iteration's tests. Finally, the programmer or team refactors the code to accommodate changes. A key TDD concept is that preparing tests before coding facilitates rapid feedback changes. Note that test-driven development is a software design method, not merely a method of testing.

    http://en.wikipedia.org/wiki/Test-driven_development

     

    You say you got 7 years of VBA? Then you should get what's in the link either VB, C# or both.

    http://www.dofactory.com/Framework/Framework.aspx

     

     

    • Marked as answer by ryguy72 Wednesday, October 17, 2012 7:02 PM
    Sunday, August 1, 2010 11:23 AM
  • 5. no optional parameters with function parameters

    That's no longer true.
    • Marked as answer by ryguy72 Wednesday, October 17, 2012 7:01 PM
    Sunday, August 1, 2010 4:37 PM
  • C# and VB are essentially identical.  They differ in syntax.  If you want to spend your time productively, learn C++.  It covers the other 90% of programming. 
    • Marked as answer by ryguy72 Wednesday, October 17, 2012 7:01 PM
    Sunday, August 1, 2010 6:18 PM
  • C# doesn't have With statement .
    • Marked as answer by ryguy72 Wednesday, October 17, 2012 7:01 PM
    Monday, August 2, 2010 3:50 AM
  • You have to decide what is important.  If you want to be a lifelong programmer (basically a guru), learn C++.  VB in any form and C# are high level languages.  They enable the average coder to develop a useful application for internal use in mimimal time.  C++ enables an accomplished programmer, to develop an optimum application for all users.  C++ provides access to the hardware that the higher level languages don't.  My point is that, if you know VB, you can assimilate C#.  If you want to expand your knowledge, learn C++. 
    • Marked as answer by ryguy72 Wednesday, October 17, 2012 7:01 PM
    Monday, August 2, 2010 9:56 PM
  • Hello all!  I’d like to know some pros and cons of C#.NET and better understand how it compares to VB.NET.  I’ve studied VB.NET for about 1 year.  I have been reading several 1,000+ page books on VB.NET and I have reading through discussion group posts on my own.  I have no formal classroom education and very little formal training…with the exception of developing one web site for a friend using ASP.NET and VB-code-behind.  I am now trying to teach myself C# (I’ve been at it for a couple months now).  I have been programming in VBA for 7 years.

    Basically, I’d like to know how C#.NET compares to VB.NET.  I’ve seen a couple web sites that literally convert VB.NET into C#.NET (and vice versa).  It seems like the syntax is similar, and it seems like the functionality is similar.   Am I right?  I am thinking of getting away from VB.Net and focusing just on C#.NET.  Again, I know VBA quite well and thus I fell like I don’t have to spend significant time learning VB.NET (which seems VERY similar).  Also, it seems like many employers want people with strong C#-skills, right.

    Can someone offer some tips, comments, suggestions, advice, etc.

    Thanks!!

    Ryan---

    Hi Ryan, quick background. Developed in VBA probably same length of time as yourself, move to VB.NET couple more years, and now I only ever program in C#. Why the change?

    It's because of tool support. Testing frameworks (have you looked into test driven development? you should, you really really should), tools for automating testing use C# lamba statement; mocking frameworks that make testing easier use C# lambda statements; IoC containers use C#.... and so on... Resharper... the best development tool out there ... C#....

    Books... the best books on development at the code level... are.... well mostly Java based... you will not read these if you only code in VB...sorry VBers but it's true :(

    Ryan... learn C#, learn test driven development, and learn about agile development. It's a better way to develop.

    I'm really sorry VB developers, please don't hate on me.

     


    Will code for money.
    • Marked as answer by ryguy72 Wednesday, October 17, 2012 7:00 PM
    Monday, August 2, 2010 10:38 PM
  • In framework 4.0 c# has optional parameters.

     


    www.rafaelalmeida.net
    Rafael S. Almeida
    PS: Don't forget to mark this post as an answer if it helps you.
    • Marked as answer by ryguy72 Wednesday, October 17, 2012 7:00 PM
    Tuesday, August 3, 2010 2:41 AM
  • They are very similar, the bigger difference is the semi column ; in the end of an expression, and in c# dont have dim, u have to use the variable type.

    all the other things are very similar.


    www.rafaelalmeida.net
    Rafael S. Almeida
    PS: Don't forget to mark this post as an answer if it helps you.
    • Marked as answer by ryguy72 Wednesday, October 17, 2012 7:00 PM
    Tuesday, August 3, 2010 2:43 AM
  • As a VB.NET programmer of several years, I believe you will find VB.NET easier to learn, coming from VBA, than C# - VBA is "Visual Basic for Applications." 

    With Visual Studio 2010 and 2012, several of the language gaps between VB and C# are closing, but not all.  C# does offer more tools for refactoring, etc.  More reference materials and training videos are available for C#.  If you are just wanting to continue automating in your Finance world, probably stick with VB, but do, as was suggested, learn about Test Driven Development.  That way, if one of your programs turns out to be a super-star and you need to add to it down the road, you can do that and know that you're not breaking something else already in existence.

    I don't like a lot of the features of C# which is why I still program in VB.  I don't like the extraneous punctuation like ; and {}.  I don't like the fact that it is case sensitive, although many C# developers do like that, as they can use that as a tool for differentiating between an instance (keyed lower case generally) vs. the true class (keyed camel case). 

    Try a quick program in C# and see if it feels comfortable coming from VBA. 

    It really becomes a personal choice if these are stand-alone programs for your own use and not driven by corporate policy.  If you think you'd end up collaborating with other individuals in your company, find out what the corporate standard is, or at least the preference.  Since you are the beginning point and can go either direction, you might was well go with the flow.

    Good luck. Kay

    • Marked as answer by ryguy72 Wednesday, October 17, 2012 6:50 PM
    Wednesday, October 17, 2012 6:29 PM

All replies

  • Hi There,

    I have been using VB6  then VB.net and then C# since longtime.

    There are few things in each language which you can't do in other.

    But I enjoyed C# the most while programming. 

     

    Following is a brief comparison of C# and VB..

    http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Visual_Basic_.NET

    Here are quick lessons if you want to move from VB to C#..

    http://www.harding.edu/fmccown/vbnet_csharp_comparison.html


    Mubi | http://mrmubi.com | Mark The Best Replies As Answers!
    Sunday, August 1, 2010 9:26 AM
  • IMO

    They do the same.. Sure, one might have a few prebuilt libraries that the other doesnt, but that doesnt mean that it cant be done on either side.

    It's really about what you prefer, what you find easiest to code/read..

    I prefer C over VB, less wordy. But again, this is my opinion.

    • Marked as answer by ryguy72 Wednesday, October 17, 2012 7:02 PM
    Sunday, August 1, 2010 9:52 AM
  • For going to program in c# if you are good in vb then mind follow steps

    1. c# is case sensitive

    2. c# is strongly typed... means you have to convert types while assigning to different type

    3. statements end with semicolon ;

    4. no sub or function use public void x() for sub and public <returntype> x() for functions

    5. no optional parameters with function parameters

    6. shared replaced with static

     

    and lot of others for starting this is enough i suppose i more thing in the place of imports System like header command use using System;

    • Marked as answer by ryguy72 Wednesday, October 17, 2012 7:02 PM
    Sunday, August 1, 2010 10:10 AM
  •  
    "ryguy72" wrote in message news:24f36572-db25-42d5-b22c-c7a71285405a...

    Can someone offer some tips, comments, suggestions, advice, etc.

     

    My response -------------------------------------------------------------------------------------------------------

     

    It's not about VB or C# .NET, but rather, it's about this. If you know it, then it doesn't matter which one you use.

    What is Object-oriented-programming?

    (OOP) is a programming paradigm that uses "objects" and their interactions to design applications and computer programs.

    The key concepts of OOP are the following:

    Class  <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

    Object  <o:p></o:p>

    Instance  <o:p></o:p>

    Method  <o:p></o:p>

    Message passing  <o:p></o:p>

    Inheritance  <o:p></o:p>

    Abstraction  <o:p></o:p>

    Encapsulation  <o:p></o:p>

    Polymorphism  <o:p></o:p>

    Decoupling  <o:p></o:p>

    <o:p> </o:p>

    http://en.wikipedia.org/wiki/Object-oriented_programming

    No matter what development platform Java,  .Net or others  OOP is OOP.

    http://math.hws.edu/eck/cs124/downloads/OOP2_from_Univ_KwaZulu-Natal.pdf

    What are design patterns?

    Design patterns are recurring solutions to software design problems you find again and again in real-world application development. Patterns are about design and interaction of objects, as well as providing a communication platform concerning elegant, reusable solutions to commonly encountered programming challenges.

    http://www.developer.com/design/article.php/1502691

    http://www.dofactory.com/Patterns/Patterns.aspx

     

    What is Domain Driven Design?

    (DDD) is an approach to the design of software, based on the two premises

    that complex domain designs should be based on a model, and that, for most software projects, the primary focus should be on the domain and domain logic (as opposed to being the particular technology used to implement the system).

    http://en.wikipedia.org/wiki/Domain-driven_design

     

    What is Test Driven Design?

    (TDD) is a software development technique that uses short development iterations based on pre-written test cases that define desired improvements or new functions. Each iteration produces code necessary to pass that iteration's tests. Finally, the programmer or team refactors the code to accommodate changes. A key TDD concept is that preparing tests before coding facilitates rapid feedback changes. Note that test-driven development is a software design method, not merely a method of testing.

    http://en.wikipedia.org/wiki/Test-driven_development

     

    You say you got 7 years of VBA? Then you should get what's in the link either VB, C# or both.

    http://www.dofactory.com/Framework/Framework.aspx

     

     

    • Marked as answer by ryguy72 Wednesday, October 17, 2012 7:02 PM
    Sunday, August 1, 2010 11:23 AM
  • Thanks Mr.Mubi!!

    Both resources are excellent.

     

    Thanks everyone else.  Anything else?  Or, is it now just a matter of just jumping in and getting going with the overall learning process?

     

    Sunday, August 1, 2010 3:04 PM
  • 5. no optional parameters with function parameters

    That's no longer true.
    • Marked as answer by ryguy72 Wednesday, October 17, 2012 7:01 PM
    Sunday, August 1, 2010 4:37 PM
  • On 8/1/2010 11:04 AM, ryguy72 wrote:
    > Thanks Mr.Mubi!!
    >
    > Both resources are excellent.
    >
    > Thanks everyone else. Anything else? Or, is it now just a matter of just
    > jumping in and getting going with the overall learning process?
    >
     
    Either dump the load or get off the pot......
     
    Sunday, August 1, 2010 5:10 PM
  • Just yesterday I committed 10 hours to working on C#problems; today another 12 hours.  Tomorrow...well...full steam ahead!!
    Sunday, August 1, 2010 6:09 PM
  • C# and VB are essentially identical.  They differ in syntax.  If you want to spend your time productively, learn C++.  It covers the other 90% of programming. 
    • Marked as answer by ryguy72 Wednesday, October 17, 2012 7:01 PM
    Sunday, August 1, 2010 6:18 PM
  • C# doesn't have With statement .
    • Marked as answer by ryguy72 Wednesday, October 17, 2012 7:01 PM
    Monday, August 2, 2010 3:50 AM

  • @John

     

    I was under the impression that C# could do everything that C++ could do.  I thought the code executed a little slower, but was MUCH faster to develop in (due to drag/drop functionality, i.e., computer-writing-code-as-objects-are-added).  Am I wrong about this?  I suspect C# can do everything that VBA/VB can do, right (you, yourself, said that these two are essentially identical).  I spoke with someone recently who said VBA can do virtually everything C++ can do.  Is that right?  Therefore, as I alluded to above, C# can do anything that C++ can do.

     

    Please correct me if I am wrong.  I am trying to learn about the scope of possibilities here.

     

    Thanks everyone!  Very enlightening!!

     

    Ryan--

     

    Monday, August 2, 2010 4:57 AM
  • You have to decide what is important.  If you want to be a lifelong programmer (basically a guru), learn C++.  VB in any form and C# are high level languages.  They enable the average coder to develop a useful application for internal use in mimimal time.  C++ enables an accomplished programmer, to develop an optimum application for all users.  C++ provides access to the hardware that the higher level languages don't.  My point is that, if you know VB, you can assimilate C#.  If you want to expand your knowledge, learn C++. 
    • Marked as answer by ryguy72 Wednesday, October 17, 2012 7:01 PM
    Monday, August 2, 2010 9:56 PM
  • Hello all!  I’d like to know some pros and cons of C#.NET and better understand how it compares to VB.NET.  I’ve studied VB.NET for about 1 year.  I have been reading several 1,000+ page books on VB.NET and I have reading through discussion group posts on my own.  I have no formal classroom education and very little formal training…with the exception of developing one web site for a friend using ASP.NET and VB-code-behind.  I am now trying to teach myself C# (I’ve been at it for a couple months now).  I have been programming in VBA for 7 years.

    Basically, I’d like to know how C#.NET compares to VB.NET.  I’ve seen a couple web sites that literally convert VB.NET into C#.NET (and vice versa).  It seems like the syntax is similar, and it seems like the functionality is similar.   Am I right?  I am thinking of getting away from VB.Net and focusing just on C#.NET.  Again, I know VBA quite well and thus I fell like I don’t have to spend significant time learning VB.NET (which seems VERY similar).  Also, it seems like many employers want people with strong C#-skills, right.

    Can someone offer some tips, comments, suggestions, advice, etc.

    Thanks!!

    Ryan---

    Hi Ryan, quick background. Developed in VBA probably same length of time as yourself, move to VB.NET couple more years, and now I only ever program in C#. Why the change?

    It's because of tool support. Testing frameworks (have you looked into test driven development? you should, you really really should), tools for automating testing use C# lamba statement; mocking frameworks that make testing easier use C# lambda statements; IoC containers use C#.... and so on... Resharper... the best development tool out there ... C#....

    Books... the best books on development at the code level... are.... well mostly Java based... you will not read these if you only code in VB...sorry VBers but it's true :(

    Ryan... learn C#, learn test driven development, and learn about agile development. It's a better way to develop.

    I'm really sorry VB developers, please don't hate on me.

     


    Will code for money.
    • Marked as answer by ryguy72 Wednesday, October 17, 2012 7:00 PM
    Monday, August 2, 2010 10:38 PM
  • @John

    I have my MBA in finance and I have a passion for all things pertain to finance.  I learned VBA to automate a lot of processes that I found myself dealing with on a day to day basis.  I am now interested in learning C# so I can do more enterprise-level work.  Also, it seems to me, C# picks up where VBA leaves off (certainly developing Windows apps and ASP.Net with C# code-behind).  With VBA, you are kind of restricted to the application itself, although I’ve done a lot of work referencing other objects (Excel to Access/Access to Excel, Excel to Word/Word to Excel, Excel to Outlook/Outlook to Excel, and Excel to Web/Web to Excel).  Now, I’m looking to do larger projects and, and as far as I can tell, I’ll need some more powerful tools … probably C# and SQL Server … for instance.  However, I don’t want to become a professional developer.  I want to learn C# pretty well, and leverage the power of technology, but focus mostly on finance.  Does that make sense?

     

    @Derek

    Sorry, I don’t really know what you’re talking about.  Maybe in 6 mos. Or so this will be more meaningful.  Now, not at all.

    Monday, August 2, 2010 11:58 PM
  • In framework 4.0 c# has optional parameters.

     


    www.rafaelalmeida.net
    Rafael S. Almeida
    PS: Don't forget to mark this post as an answer if it helps you.
    • Marked as answer by ryguy72 Wednesday, October 17, 2012 7:00 PM
    Tuesday, August 3, 2010 2:41 AM
  • They are very similar, the bigger difference is the semi column ; in the end of an expression, and in c# dont have dim, u have to use the variable type.

    all the other things are very similar.


    www.rafaelalmeida.net
    Rafael S. Almeida
    PS: Don't forget to mark this post as an answer if it helps you.
    • Marked as answer by ryguy72 Wednesday, October 17, 2012 7:00 PM
    Tuesday, August 3, 2010 2:43 AM
  • Good stuff!!! 

    Thanks everyone!

    Thursday, August 5, 2010 7:46 PM
  • As a VB.NET programmer of several years, I believe you will find VB.NET easier to learn, coming from VBA, than C# - VBA is "Visual Basic for Applications." 

    With Visual Studio 2010 and 2012, several of the language gaps between VB and C# are closing, but not all.  C# does offer more tools for refactoring, etc.  More reference materials and training videos are available for C#.  If you are just wanting to continue automating in your Finance world, probably stick with VB, but do, as was suggested, learn about Test Driven Development.  That way, if one of your programs turns out to be a super-star and you need to add to it down the road, you can do that and know that you're not breaking something else already in existence.

    I don't like a lot of the features of C# which is why I still program in VB.  I don't like the extraneous punctuation like ; and {}.  I don't like the fact that it is case sensitive, although many C# developers do like that, as they can use that as a tool for differentiating between an instance (keyed lower case generally) vs. the true class (keyed camel case). 

    Try a quick program in C# and see if it feels comfortable coming from VBA. 

    It really becomes a personal choice if these are stand-alone programs for your own use and not driven by corporate policy.  If you think you'd end up collaborating with other individuals in your company, find out what the corporate standard is, or at least the preference.  Since you are the beginning point and can go either direction, you might was well go with the flow.

    Good luck. Kay

    • Marked as answer by ryguy72 Wednesday, October 17, 2012 6:50 PM
    Wednesday, October 17, 2012 6:29 PM
  • Thanks, Kay!  I've learned a lot in the past 2+ years, since I first posted this discussion.  I don't necessarily like the ;-stuff and the {}-stuff and the case-sensitive nature of C#.  However, I think it forces a developer to be more disciplined, and that is probably the point of it.

    I'm trying to get out of my development role, and go much deeper into finance.  I'd like to continue using VBA and Visual Studio, but only to solve finance-related problems, and/or as a hobby.  I do think dev work is fun and interesting, but personally, I don't see myself making a career of it.  I've been doing this exclusively for the past 6+ years, and I'm finding it kind of difficult to make a transition now, so who knows, I may continue doing this for a bit longer, as it does pay the bills these days.

    Thanks to all who offered their professional insight, and took the time to answer my questions.


    Ryan Shuell

    Wednesday, October 17, 2012 6:57 PM
  • You have now got the var keyword, used mainly in LINQ for declaring an implicitally typed variable, whose type's known at compile-time, and the dynamic keyword, for declaring dynamic variables, where the type is known at run-time.

    João Miguel

    Wednesday, October 17, 2012 7:17 PM