VB/C# question
-
OK, I admit it, all my .net development experience has been in vb. I'm moving in a couple weeks, and have been offered a new job at a small company working on their ecommerce sites, which are all written in C#. I've told the lead developer there that my work experience has always been vb (got a little C from way back), he doesn't seem concerned. I'm up for learning C#, and probably should anyway, but I'm a bit worried about getting up to speed. My question - other than the syntax differences, are there any major differences between vb & C# that I should focus on first? don't want to turn this into an argument, just want to get some advice on where to begin. Any book recomendations would help. thanks
This is a useful syntax reference. I'm mainly a C# person, and consult it regularly when having to do VB maintainance. http://www.harding.edu/USER/fmccown/WWW/vbnet_csharp_comparison.html[^]
-- Rules of thumb should not be taken for the whole hand.
-
OK, I admit it, all my .net development experience has been in vb. I'm moving in a couple weeks, and have been offered a new job at a small company working on their ecommerce sites, which are all written in C#. I've told the lead developer there that my work experience has always been vb (got a little C from way back), he doesn't seem concerned. I'm up for learning C#, and probably should anyway, but I'm a bit worried about getting up to speed. My question - other than the syntax differences, are there any major differences between vb & C# that I should focus on first? don't want to turn this into an argument, just want to get some advice on where to begin. Any book recomendations would help. thanks
I had 4 years programming experience with VB.Net and all of the sudden switched to C#. I was up to speed in two weeks. It's easy don't worry about it.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things --thedailywtf 3/21/06
-
Given that you're already familiar with .NET a good book to get you up to speed on C# is Jesse Liberty's Programming C# (now in its 4th ed) because it focuses more on the language and less on ADO.NET, Win Forms, etc., although it does cover those topics too. BTW, I've just gone the other way recently - from C# to VB. Though I had done a little VB .NET before and a lot of VB before. Something that will also be handy as you go along are those VB-C# converters. The one at http://www.developerfusion.co.uk[^] is good.
Kevin
The converter at developerfusion [^]is a ancient version of the SharpDevelop C#<->VB converter. http://developer.sharpdevelop.net/codeconvert.net/[^] (will go offline sometime today, we're getting a new server) runs a more recent version that supports .NET 2.0 and doesn't drop comments in the conversion. You can also install SharpDevelop and convert files (or whole projects) offline. Note that it is a syntax converter only - it won't correct the semantics (except for a few special cases), especially because it is unable to know what type an expression has, so it does not know whether to convert 'var("name")' to 'var("name")' or 'var["name"]'.
-
The converter at developerfusion [^]is a ancient version of the SharpDevelop C#<->VB converter. http://developer.sharpdevelop.net/codeconvert.net/[^] (will go offline sometime today, we're getting a new server) runs a more recent version that supports .NET 2.0 and doesn't drop comments in the conversion. You can also install SharpDevelop and convert files (or whole projects) offline. Note that it is a syntax converter only - it won't correct the semantics (except for a few special cases), especially because it is unable to know what type an expression has, so it does not know whether to convert 'var("name")' to 'var("name")' or 'var["name"]'.
I'm still doing .NET 1.1 and found it good enough for my purposes.:) Even if you have to tweak the results a bit it's still preferable to starting from scratch.
Kevin
-
I'm still doing .NET 1.1 and found it good enough for my purposes.:) Even if you have to tweak the results a bit it's still preferable to starting from scratch.
Kevin
Well, the new version doesn't drop comments and auto-renames fields when converting from C# to VB and a field name collides with a property name because both only differ in case. But a high-level C# <-> VB converter can never work without manual tweaking. If you want to optimally keep the old behavior, you have to decompile into the new language using Reflector. Which (to come back on topic) is a good tool to learn the differences between C# and VB because you can see what's going on under the hood when you use VB.
-
Well, the new version doesn't drop comments and auto-renames fields when converting from C# to VB and a field name collides with a property name because both only differ in case. But a high-level C# <-> VB converter can never work without manual tweaking. If you want to optimally keep the old behavior, you have to decompile into the new language using Reflector. Which (to come back on topic) is a good tool to learn the differences between C# and VB because you can see what's going on under the hood when you use VB.
Daniel Grunwald wrote:
But a high-level C# <-> VB converter can never work without manual tweaking. If you want to optimally keep the old behavior, you have to decompile into the new language using Reflector. Which (to come back on topic) is a good tool to learn the differences between C# and VB because you can see what's going on under the hood when you use VB.
So why doesn't someone write a converter that does that, and then uses the original source to reimport the comments?
-- Rules of thumb should not be taken for the whole hand.
-
Daniel Grunwald wrote:
But a high-level C# <-> VB converter can never work without manual tweaking. If you want to optimally keep the old behavior, you have to decompile into the new language using Reflector. Which (to come back on topic) is a good tool to learn the differences between C# and VB because you can see what's going on under the hood when you use VB.
So why doesn't someone write a converter that does that, and then uses the original source to reimport the comments?
-- Rules of thumb should not be taken for the whole hand.
Probably because the decompiler from Reflector cannot be reused but is obfuscated; and writing such a decompiler is not an easy task. And because it's hard to find the correct position to re-insert the comments - the decompiler would have to associate the generated code lines with IL statements which then can be associated with the original source lines using the debug symbols. And did you ever look at the C# code generated from "VB" IL? Tons of calls into Microsoft.VisualBasic.dll, even for the most simple things like comparing two strings. Not to mention many foreach-loops get expanded into a "enumerator = ...; try { while(...) {...} } finally { enumerator.Dispose(); }" mess. In the other direction, it is able to "convert" C# anonymous methods to VB, but the resulting code isn't maintainable in any way.
-
OK, I admit it, all my .net development experience has been in vb. I'm moving in a couple weeks, and have been offered a new job at a small company working on their ecommerce sites, which are all written in C#. I've told the lead developer there that my work experience has always been vb (got a little C from way back), he doesn't seem concerned. I'm up for learning C#, and probably should anyway, but I'm a bit worried about getting up to speed. My question - other than the syntax differences, are there any major differences between vb & C# that I should focus on first? don't want to turn this into an argument, just want to get some advice on where to begin. Any book recomendations would help. thanks
-
OK, I admit it, all my .net development experience has been in vb. I'm moving in a couple weeks, and have been offered a new job at a small company working on their ecommerce sites, which are all written in C#. I've told the lead developer there that my work experience has always been vb (got a little C from way back), he doesn't seem concerned. I'm up for learning C#, and probably should anyway, but I'm a bit worried about getting up to speed. My question - other than the syntax differences, are there any major differences between vb & C# that I should focus on first? don't want to turn this into an argument, just want to get some advice on where to begin. Any book recomendations would help. thanks
I started programming 5 years ago in C++. After a year, i moved on to C#. I had no VB or VB.Net experience. Two weeks ago a girl I really like asked me to help her with her VB.Net application. I didn't want to disappoint so I said ok, knowing that I have no prior experience in VB. The day came, I got hold of a VB book, I paged through the book for about 30 minutes. 3 hours later, her application is running, no errors, 100% fullproof. Guess who wrote all the code, I did... Moral of the story: All this crap is the same, only the syntax is different. I now good in VB as well.
-
OK, I admit it, all my .net development experience has been in vb. I'm moving in a couple weeks, and have been offered a new job at a small company working on their ecommerce sites, which are all written in C#. I've told the lead developer there that my work experience has always been vb (got a little C from way back), he doesn't seem concerned. I'm up for learning C#, and probably should anyway, but I'm a bit worried about getting up to speed. My question - other than the syntax differences, are there any major differences between vb & C# that I should focus on first? don't want to turn this into an argument, just want to get some advice on where to begin. Any book recomendations would help. thanks
I am always concerned about their favored language when hiring programmers. I have no doubt at all that this has a huge bearing on how a programmer performs. There is a distinct difference between programmers that come from a C++ background and a Visual Basic background. Dare I say that VB programmers are "hackier" programmers, where they are more apt to use long winded hacks than C#/C++ programmers. With that said, let the flames fly. It's my opinion, and I'm sticking to it.