Reputation: 4285
What are some good exercises that an intermediate/advanced VB.NET web programmer should to do gain syntax chops on C#?
I imagine some good examples would be:
Upvotes: 5
Views: 2082
Reputation: 6006
A good excercise would be trying to understand other people's C# code snippets, and reproducing them yourself from scratch. This means that you'll encounter lots of stuff you need to look up and learn in order to understand to see what those snippets are doing.
The good news is that, both in C# and VB.Net, the .NET framework does most of the heavy lifting, so you'll probably understand and recognize those parts. I use both C# and VB.Net in my job and I've come to realize that, because of the shared framework, the languages aren't that different from each other in practice.
I still like C# better, since I feel it results in cleaner code, somehow.
Upvotes: 0
Reputation: 28869
Because programming in .NET is more about the Framework than any specific language or syntax on top, the MSDN documentation is invaluable for crossing over C# and VB.NET barriers because it contains one-to-one samples of using C# and VB.NET syntax for .NET common elements. For example if you look up delegates you will find the same sample in both syntaxes.
For syntax-specific elements other people have posted some good sources.
Upvotes: 1
Reputation: 158309
I made the trasition by taking one of my hobby projects that was done in VB.NET and re-write it in C#. That got me started in a good manner; learning the syntax while working in a known problem domain, while also providing real-world problems to solve.
Upvotes: 3
Reputation: 16980
Practice forgetting VB.NET [:)], then learn C# as a usual person would learn. I don't think VB.NET-coders have some special way of learning C#... You'll just be familiar with the .NET class library, it's a plus.
Upvotes: 0
Reputation: 5981
If you have a basic grasp of the language, I would recommend working through project Euler (http://projecteuler.net/) in C#. It starts out very easy and slowly becomes more and more difficult, requiring you to learn more about the language [you are using to develop the solutions] in order to solve the problems.
It may make sense to pick up a C# reference book, if you haven't already.
I think you will be surprised how quickly you transition.
Upvotes: 1
Reputation: 172270
Look up the very basics (how to define a function, how to define a variable), then start coding C# in a real project. Look stuff up once you get stuck (or try the automatic converters mentioned in another answer). The differences are not large, so it will not delay your project significantly. Since there is (almost) a 1:1 correspondence between VB.NET and C# code, it's usually okay to "think VB.NET" and then write your code in C#.
After you are familiar with the syntax, google for the differences between VB.NET and C# (i.e. what can you do in C# that won't work in VB.NET -- e.g. anonymous methods) and rework those things where C# allows for a more elegant solution.
Upvotes: 1
Reputation: 57946
I think best exercise would to build something for yourself.
This way you can to define your scope, to "negotiate" new features and to write new code just for fun.
You could also to solve again problems you already know; for instance, I recommend trying to solve some problems from Project Euler in C#.
Upvotes: 9
Reputation: 47726
Wikipedia has a great article on this:
http://en.wikipedia.org/wiki/Comparison_of_C_Sharp_and_Visual_Basic_.NET
Upvotes: 1
Reputation: 564413
Play with your own code using an automatic converter.
It should work fairly well for most things. You'll mostly just need to figure out how to rework lambdas and some other situations like that.
Reflector is also very good to help you figure out how to play with converting your code.
As for learning the differences, see MSDN's white paper on this. It's a bit out of date, but a good starting point. A more complete, but less textual reference-like comparison, is available here.
Upvotes: 1