From VB.NET to C# RRS feed

  • Question

  • I am an experienced VB/VB.NET developer with about 15 years of experience.  I am on a new project that is coded in C#, I have always wanted to learn C# so I welcome this opportunitiy.  I am interested in learning the C# syntax as quickly as possible.  I bought a C# book, it is very wordy...great book for beginners but not for someone like me who is only interested in syntax difference in C# vs VB.NET.  I would appreciate any input on this.  Thanks!
    Monday, May 24, 2010 5:45 PM


All replies

  • Since you already know .NET a book may be over-kill and you may find that online articles are a far more efficient way to learn C#. One such example:


    • Marked as answer by SharePointBas Tuesday, May 25, 2010 12:13 AM
    Monday, May 24, 2010 5:57 PM
  • I am just learning c# too, being a VB programmer... what really helped me out was this VB to C# translation site...http://converter.telerik.com/... after a short time you will be able to write all your c# like you do the VB. Always remember... dont forget that ';' after everyline.

    Good Luck!


    Monday, May 24, 2010 5:58 PM
  • The most significant difference will be variable declarations.  Compared to VB, C# is almost like a Reverse Polish Notation.  You must also end every line with a semi-colon.  Otherwise the compiler will think the line of code is continued onto the next line, (Like the VB underscore).  Brackets are used to delineate the beginning and ending of code blocks,(Like the VB "End" keyword.)

    Dim number As Int32

    Int32 number;

    In method declarations, Change "Sub" to "void".

    Private Sub Method00()

    End Sub

    private void Method()



    Change "Function" to the object type.

    Private Function Method00() As Object

        Return New Object();

    End Sub

    private Object Method()


        return new Object();



    Method declarations of the parameters look just like variable declarations.

    Private Sub Method00(ByVal sender As Object, EventArgs e)

    End Sub

    private void Method(Object sender, EventArgs e)




    There's more, but those are the highlights.  See Nishant's link.

    Mark the best replies as answers. "Fooling computers since 1971."
    • Proposed as answer by JohnGrove Monday, May 24, 2010 8:33 PM
    Monday, May 24, 2010 6:08 PM
  • I see this question several times a day from newbie’s to professionals. I have listed the best C# books that I have read so far.


    1. ECMA-334 C# Language Specification . – FREE book. This is probably the best place to start. Read it backwards and forwards and you can even request a hard copy.
    2. Absolute Beginners Guide to C Sharp 2nd Edition – Used this early on and found it very useful even if its game programming.
    3. C-Sharp 2.0 - The Complete Reference , 2nd Edition (McGraw-Hill, 2006) – One of the most useful books that is always with me. It contains short example code and is very well written.
    4. Dot Net Zero - Charles Petzold   - FREE book and you should definately give it a read.
    5. C Sharp in Depth by Jon Skeet -  Probably one of the most in depth books on C Sharp and definitely not for beginners. Jon Skeet knows C# like no other. I would consider this book the Bible of C#. If you understand 50% of this book, you have a good understanding of the language. 
    6. CLR via C Sharp 3rd Edition – I just started reading this book and it is another book thats not for beginners. If you really want to understand the CLR then give this book a try.

    Well, thats it. I hope you enjoy the books as I have spent a lot of time researching different C# books.

    My .NET Blog: http://michaelcrump.net
    Monday, May 24, 2010 6:25 PM
  • A good way, I've found to learn C# knowing VB, is to load VB projects into SharpDevelop, convert to C# and get the project to run as it did in VB.  I find it easiest to load the converted project into Visual Studio.  The intellisense is much better in VS.  Doing it this way, you won't waste time on the parts of the languages that are the same, but concentrate on the differences.
    Monday, May 24, 2010 8:26 PM
  • Thanks everyone for your response, I am glad I posted this question...got a lot of really good responses.
    Tuesday, May 25, 2010 12:14 AM