开发者

How do I tune up my C# Skills, when I have spent the last decade coding in VB?

I started my career coding in C/C++ on a vax system, but got into a few contracts where it was all VB and then became a specialist in VB, then to VB.net. Now I am aspiring to work for Microsoft and it seems that every job they post is in C/C++/C# and I can barely read C# code, it looks like the most convoluted mess to me and the inline syntax almost hurts my feelings.

I am looking for positive, non-flaming, helpful suggestions on how to pick up C# skills again. Books..Labs..etc? I have been coding simple projects using Silverlight and C# to try and work it out but it is extremely frustrating since there are very few examples that I can find that illustrate what each code set looks like. I've Googled but have yet to find anything helpful other than channel9 labs and working through some of the example code/projects from mix10.

I am not looking for a shortcut, but a good solid skills understanding. I swear it is easier to transl开发者_如何学运维ate English to Latin than VB to C#.


I personally would start by converting a VB.NET project into C#, having done VB.NET it wouldn't be difficult once you got started as they both use the same underlying CLR.

Doing it this way step by step, looking up how to convert each bit you don't understand, you'll soon end up teaching yourself C# based on you're knowledge of VB.NET and you'll see they're really not that much different!

I find them very similar now I know them both, they just have a habit of doing things 'slightly' differently.

Also, have a look at this wiki page for a summary comparison of VB.NET and C#, and check out the examples at the bottom to see some basic syntax comparisons that will give you a starting point for converting VB.NET into C#.


Since VB.NET and C# are both first-class object-oriented .NET languages that compile down to the nearly the same CIL code, I find it fairly easy to switch between the two. Most of the learning curve in .NET comes from learning the myriad APIs; syntax doesn't take terribly long to pick up.

I'd recommend a good book that focuses on the language of C# (that is, not a framework such as Winforms, Silverlight, or WPF). A book that I really liked was Illustrated C# 2008 by Daniel Solis. It's great at exposing the C# language from end to end. (NOTE: Although it says "Illustrated" in the title, it's not filled with lots of pretty pictures. "Illustrated" simply means that the author uses lots of helpful diagrams to explain concepts).

Also, I spent a good deal of time solving math problems at http://www.projecteuler.net in order to learn C#. It helps to have real problems to solve to learn a language and Project Euler offers problems that are small enough that you can still focus on learning different aspects of the language.


It's odd that you are having this difficulty if you can still remember anything about C. I have a similar background but I don't find C# hard to read at all.

Are you getting confused by LINQ or lambdas / anonymous methods? EDIT you say it's LINQ: here are some links for LINQ.

  • The LINQ syntax is different in VB from C# and there's not much help out there for the VB syntax. The MSDN 101 VB LINQ samples are good, and I also liked the coverage in the book Programming VB 2008.
  • Lambdas are a way of writing methods inline that might be the "inline syntax" you are referring to? In which case, just read up on them and try them out: you could try them out in C# or VB.Net.

There were some useful articles on differences between C# and VB.Net in Visual Studio magazine back in Jan 2008.

  • What VB developers should know about C#
  • And for completeness, What C# developers should know about VB

You might also be interested in the question "what's allowed in VB that is prohibited in C# (or vice versa)"

Full disclosure: the bottom part of this answer is copied almost unchanged from this question on converting C# knowledge to VB.Net


Buy "Head first C#" and enjoy yourself coding. It is the best book (according to me and a few others) on the market learning C#.

How do I tune up my C# Skills, when I have spent the last decade coding in VB?


Scott Hanselman posts a regular column of his blog called the "Weekly Source Code", which is made of source code -- generally C# --- which you can learn from by reading.


My first choice is that given by W69rdy: convert some project you've already done in VB to C#.

Second, I would skim the C# documentation, or an online source like that suggested by James, at least once a day looking for something you don't understand. Perhaps something as simple as a language keyword you don't recognize. Then write something that uses it: even something as simple as a small snippet.


If you are looking for a quick read and tutorial, this one will work. I agree with @TechNeilogy and @W69rdy that converting a program from VB.NET to C# will help with understanding the similiarities and differences between the languarges.

I converted a VB.NET Windows service to a C# Windows service and it helped greatly with trying to learn C#.


I was a VB .NET programmer as well. I found that using Jetbrain's Resharper Visual Studio plug-in really helped my learning curve. I was initially converting/optimizing a VB .NET project into C# and I found the coding assistance tools really helpful. Most of the time, I was just trying to find the C# equivalent so code completion usually put me in the right direction.


I've also recently been moving to C# from VB - I've found this converter invaluable as a learning tool when you don't know a bit of C# syntax but you can write it in VB.


You should start with some C# tutorials in internet to understand the how to work with c#, then read a book with maximum 300 pages. After that you can start the converting from VB to C#. It is not difficult. Good luck.


I use both vb.net and c# at work. Sometimes in the same project even. Honestly, when you switch back and forth, after the first couple misplaced or missing ; or Dim's, it's pretty easy to jump between the two. The rest of the stuff (class modifiers, event handlers, etc.) is only a quick google away.


The only way you are really going to make the step across, is to just make the step across and run with it!

Sure, check out a basic tutorial or read a guide on C# to learn the syntax basics, but then you need to find a reasonably simple, self-contained project to get stuck into. If you know some of the .NET framework (which you presumably do), then the jump won't actually be that great. Obviously, don't pick a vast, complex, mission-critical system to start with!

In fact, although my current project is my first c# project, I can't believe I didn't make the switch earlier. Apart from enjoying C#, I'm also finding it easier because I'm finding there are more good quality examples around.


I don't mean this patronisingly, but the answer is to simply start coding in C#!

There are plenty of books, resources, training CDs (check out AppDev.com for some great video based training) but nothing compares to just coding for real-life problems!

(And I agree with a previous comment about converting a recent project to C#.)

"That which we learn to do, we learn by doing" Aristotle

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜