Learning C# as a VB.NET programmer
Asked Answered
B

6

5

I am looking to switch to C#. I come from a C / C++ background but C# is a little different for me. I am switching mainly because of Silverlight and MVVM; all examples are in C#. Any information is in C# and I am confused when I read through it all.

What is a good place to start learning C# when starting with existing C / C++ knowledge?

Babul answered 13/1, 2010 at 19:0 Comment(2)
No i simply want to become c# intelligent. When i look through c# examples a lot of the base code seems hidden. which is fine but i figure if i start at square 1 i can sprint to the endBabul
Duplicate: stackoverflow.com/questions/287927/best-way-to-learn-cBruit
C
17

Start writing code in C# ASAP. Only way to learn the language is to write it. You already understand VB.NET. You've got a huge lead on anyone new to .NET.

Take a smallish application you've written in VB.NET and methodically change it over to C#.

You'll learn the syntax, etc. quickly.

Write all of your future projects in C#. Just force yourself into the change and you'll do fine.

Charwoman answered 13/1, 2010 at 19:4 Comment(4)
+1 Nothing beats experience. Just keep a keyword comparison reference open. i.e. en.wikipedia.org/wiki/…Southeastwards
Agreed! Just dive in and start programming!Cortezcortical
Thanks Guys.. I guess just get off my tail and run ;)Babul
Ditto and learn from little snippets here: java2s.com/Code/CSharp/CatalogCSharp.htmIndefatigable
S
1

Read the best C# books. :)

Siegbahn answered 13/1, 2010 at 19:4 Comment(1)
Just to let you know - the link in your answer doesnt exist any more. CheersDoing
B
1

Shortly after learning VB.NET I decided I'd rather be coding C#. I learned it by reading a couple of books and working on a project. Slowly, I got my coworkers converted over to the language from VB.NET as well. The languages are very similar, some code conversion is just a matter of changing syntax.

However, if you've ever worked with a true VB'er you will see VB specific functions used in their code that'll make you scratch your head. There are string handling functions and casting functions for example that you will have to convert. Also, C# has no RaiseEvent. Events take a little more effort to understand in C# because you need to wrap your mind around delegates (C++ function pointers/callbacks). As others have said, if you are coming from C++ this shouldn't be too difficult.

Many people go on about needing to work on a project to understand a language, which I agree with. However, there are features of languages which you will never know about if you don't pick up a couple of books and read about them. I've been able to show my coworkers many useful techniques just by reading a couple of books.

Lastly, C# is a great language. I was very skeptical when I first started using .NET, but now I know that MS got the right talent together for that framework and language.

Good luck.

Bhang answered 13/1, 2010 at 19:39 Comment(1)
Hey man good reply thanks for the info. I believe a book will have to be read as well :). Especially to implement silverlight and MVVM properlyBabul
T
1

The Wikipedia article "C Sharp (programming language)" is a decent introduction to C# as a language.

Teague answered 13/1, 2010 at 20:13 Comment(0)
E
0

As you know C++ (as you wrote in the question) and VB.Net (as you mentioned in the title), C# won't be hard for you if do know them both well. If this is the case, just grab any source in C#, and read it.

By the way, the article from wikipedia is a very nice intro.

Excellence answered 13/1, 2010 at 19:6 Comment(0)
R
0

One thing that may work for you is to use a converter

  1. Write your desired code in VB.
  2. Paste small pieces of code you don't know how to write in C# into http://converter.telerik.com/ and convert.
  3. Manually type the result into your C# project.

Gradually, reduce your reliance on converter as you become more familiar with language.

That is enough to get you started, however C# has language features that VB does not, or VB offers in a way that is so wordy that no one really uses it.

The more features you will come across as you look at code examples from around the web (like on stack overflow), and you need to either look up syntax or function manually, or convert from C# back to vb to understand what it is doing (use same converter). Or, just paste it in and see what it does.

Rahman answered 13/6, 2017 at 0:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.