Guest User

Untitled

a guest
Mar 28th, 2013
67
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Choosing a .NET language
  2.  
  3. *This question is intended as a signpost for the many questions similar to this.*
  4.  
  5. 1. Which is better, C# or VB.NET?
  6.  
  7. 2. Is C# faster than VB.NET?
  8.  
  9. 3. What are the differences between C# and VB.NET?
  10.  
  11. 4. Should I learn C# or VB.NET?
  12.  
  13. *This question intentionally includes phrases commonly used by programmers searching for these kinds of answers. For examples of existing questions see:*
  14.  
  15. * *http://stackoverflow.com/questions/507291/should-we-select-vb-net-or-c-sharp-when-upgrading-our-legacy-applications*
  16.  
  17. * *http://stackoverflow.com/questions/1653895/should-i-learn-vb-net-or-c*
  18.  
  19. * *http://stackoverflow.com/questions/10357146/what-is-the-difference-between-c-net-and-vb-net-except-syntax*
  20.  
  21. * *http://stackoverflow.com/questions/4358694/vb-net-vs-c-net*
  22.  
  23. -----------------------------------------------------------------------------------------------------------
  24.  
  25. Which is better, C# or VB.NET?
  26. -
  27.  
  28. *"Better"* implies a single quanitifiable attribute which can be used to rank things in the same category. The problem is that each programmer is going to be interested in different attributes, and those attributes, if they can be quantified, will have different values based on the situation. For example, how a person measures "maintainability" is going to vary based on whether that person's background is in VB6 or C++.
  29.  
  30. Essentially, any argument that one is better than the other is going to be counterbalanced by an equally valid argument reaching the opposite conclusion. See the link below for a more thorough comparison of VB.NET and C#:
  31.  
  32. [Comparison of C# and Visual Basic .NET](http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Visual_Basic_.NET#Language_comparison) (wikipedia)
  33.  
  34. Is C# faster than VB.NET?
  35. -
  36.  
  37. Both C# and VB.NET compile down to the same IL instructions. The question, then, is not which language is faster, but which compiler is more efficient.
  38.  
  39. If you strip away the VB6 legacy functions and use the same compiler optimizations (such as VB.NET's Option Strict), you'll end up with almost exactly the same IL. There are [some reports](http://geekswithblogs.net/paul/archive/2008/04/23/121537.aspx) that C#'s compiler is very slightly more efficient in some circumstances, but the general consesus is that if there is any difference (one way or the other), you almost certainly will be incapable of perceiving it.
  40.  
  41. Unless you are writing code for a nuclear research facility, the difference is not going to be noticable. (And if you are writing code for a nuclear research facility, [why are writing code in a managed language?](http://blogs.msdn.com/b/jonathanh/archive/2005/05/20/optimizing-managed-c-vs-native-c-code.aspx))
  42.  
  43. What are the differences between C# and VB.NET?
  44. -
  45.  
  46. There are three main classes of differences:
  47.  
  48. * **Differences in syntax**
  49.  
  50. There are simply too many differences in the syntax to cover them all in this answer. Fortunately, Dr. Frank McCown of the Harding University Computer Science Dept has produced a very helpful and thorough comparison here:
  51.  
  52. http://www.harding.edu/fmccown/vbnet_csharp_comparison.html
  53.  
  54. * **Differences in the IDE**
  55.  
  56. Other than syntax differences, probably the biggest noticable difference between VB.NET and C# are in the IDE features and settings. I've been unable to find a single, thorough comparison of these differences, but you can easily read up on the features of each in the documentation on MSDN:
  57.  
  58. [Using the Visual Basic Development Environment](http://msdn.microsoft.com/en-US/library/vstudio/f120x8wh)
  59. [Using the Visual C# Development Environment](http://msdn.microsoft.com/en-US/library/vstudio/ms173063)
  60.  
  61. * **Differences in the compiler**
  62.  
  63. This was already covered above (see Is C# faster than VB.NET?)
  64.  
  65. Should I learn C# or VB.NET?
  66. -
  67.  
  68. Which ever you want to. StackOverflow does not exist to tell you which career path or hobby to go after. Some have pointed out the [salary differences between C# and VB.NET](http://www.indeed.com/salary?q1=VB.Net&l1=&q2=C%23&l2=) programmers, but I have my doubts about the accuracy of these figures. If you really need help choosing one of these language, I would recommend this [extremely useful resource](http://www.random.org/coins/?num=1&cur=60-usd.0025c-pa).
  69.  
  70. Be sure though that, whichever language you choose, StackOverflow will be here to answer your language-specific questions!
RAW Paste Data