.NET Forum / ASP.NET / General / October 2007
VB.NET vs C#
|
|
Thread rating:  |
shapper - 15 Oct 2007 04:08 GMT Hello,
I have been working with Visual Studio 2005 and I use mostly VB.NET.
Sometimes I notice that a few things that were possible with C# were not possible with VB.NET.
Now I am starting to use VS 2008 and ASP.NET 3.5.
Should I use C# instead of VB.NET?
Could someone tell me the reasons to choose one or the other?
Thanks,
Miguel
Mark Rae [MVP] - 15 Oct 2007 08:48 GMT > I have been working with Visual Studio 2005 and I use mostly VB.NET. OK.
> Sometimes I notice that a few things that were possible with C# were > not possible with VB.NET. As far as I can tell, the only thing C# can do (currently) that VB.NET can't is unsafe code i.e. pointers...
> Now I am starting to use VS 2008 and ASP.NET 3.5. OK.
> Should I use C# instead of VB.NET? Only if you need to use pointers.
> Could someone tell me the reasons to choose one or the other? Other than pointers, there are none.
N.B. the above is the "official" line - I never go anywhere near VB.NET but that's out of personal preference, nothing more...
 Signature Mark Rae ASP.NET MVP http://www.markrae.net
Aidy - 15 Oct 2007 09:39 GMT I think C# can also overload operators, which VB.NET can't. But VB.NET has optional parameters that C# doesn't. Swings and roundabouts really.
>> I have been working with Visual Studio 2005 and I use mostly VB.NET. > [quoted text clipped - 20 lines] > N.B. the above is the "official" line - I never go anywhere near VB.NET > but that's out of personal preference, nothing more... Mark Rae [MVP] - 15 Oct 2007 10:02 GMT >I think C# can also overload operators, which VB.NET can't. But VB.NET has >optional parameters that C# doesn't. Swings and roundabouts really. Sure, but both of those can be worked around in either language...
Unsafe code just isn't possible in VB.NET - I don't believe it's even been included in VB.NET 2008...
 Signature Mark Rae ASP.NET MVP http://www.markrae.net
Rory Becker - 15 Oct 2007 13:13 GMT > I think C# can also overload operators, which VB.NET can't. But > VB.NET has optional parameters that C# doesn't. Swings and > roundabouts really. Actually VB has been able to Overload operators since VB2005
see http://msdn2.microsoft.com/en-us/library/ms379613(vs.80).aspx
-- Rory
Juan T. Llibre - 15 Oct 2007 13:47 GMT My.Programming.Language.Is.Better.Than.Yours()
It's quite entertaining to see the same "VBB.NET vs. C#" useless threads crop up regularly.
There's an argument which makes some sense, though, although I don't see too many C# types take advantage of it:
Who is the better programmer, the "Sharp Programmer" or to the "Basic Programmer" ?
If you're trying to sell a programming solution to your "hasn't a clue" customer, do you say "We have a team of Sharp Programmers or a team of Basic Programmers ?"
So, in that sense, it's better to be sharp than basic. Programming-wise, there's not much difference, though.
<chuckle>
In my case, I mostly use VB.NET for two reasons :
1. I hate case sensitivity with a passion. 2. I've been programming in Basic for over 25 years and in VB for over 15.
#2 is most important. I'm not about to throw years of programming experience down the drain.
Even so, I still use C# a lot, particularly when examining free source code. The C#/VB online converters have helped a lot in learning equivalent programming constructs.
The choice boils down to your personal preference and experience.
If you feel comfortable with brackets, plus signs and semi-colons, you'll be comfortable in C, C++, Java, Javascript and C#.
Otherwise, you'll be perfectly comfortable in the Basic family of languages.
Juan T. Llibre, asp.net MVP asp.net faq : http://asp.net.do/faq/ foros de asp.net, en español : http://asp.net.do/foros/ ======================================
>> I think C# can also overload operators, which VB.NET can't. But >> VB.NET has optional parameters that C# doesn't. Swings and [quoted text clipped - 6 lines] > -- > Rory Mark Rae [MVP] - 15 Oct 2007 13:59 GMT > There's an argument which makes some sense, though, > although I don't see too many C# types take advantage of it: > > Who is the better programmer, > the "Sharp Programmer" or to the "Basic Programmer" ? Ah yes, but there aren't too many Basic programmers who remind people what the second letter of the acronym 'BASIC' (allegedly!) stands for... ;-)
Of course, everyone knows what the first letter stands for... <ducks>
 Signature Mark Rae ASP.NET MVP http://www.markrae.net
Aidy - 15 Oct 2007 14:58 GMT > I'm not about to throw years of programming experience down the drain. But you're not, you're simply using a different syntax. Surely to do .net you need to learn a new methodology, thus ignoring most of what you "learned" doing VB anyway? What you learned from VB that applies to programming as a whole can be carried to .net be you learning c# or vb.net. If you are coding in .net the same way you coded in VB then I'd be worried.
The syntax differences are trivial between the two, although you're more likely to find code examples in c# than vb.net. If writing loops differently and adding a semi-colon to the end of each line is such an issue to you I'd question your skills as a coder.
Juan T. Llibre - 15 Oct 2007 15:15 GMT When you have the years of programming experience I have, feel free to throw them down the drain if you choose to.
Juan T. Llibre, asp.net MVP asp.net faq : http://asp.net.do/faq/ foros de asp.net, en español : http://asp.net.do/foros/ ======================================
>> I'm not about to throw years of programming experience down the drain. > [quoted text clipped - 6 lines] > vb.net. If writing loops differently and adding a semi-colon to the end of each line is such an issue to you I'd > question your skills as a coder. Aidy - 15 Oct 2007 15:52 GMT > When you have the years of programming experience I have, > feel free to throw them down the drain if you choose to. With respect, I'm no Johnny-Come-Lately myself. I don't feel I threw a single thing down the drain when I went from VB to C# rather than VB.NET. If I had to I could go back to VB.NET quite easily. Programming experience is more than the syntax you choose to use. With your experience I thought you'd appreciate that...
shapper - 15 Oct 2007 16:23 GMT > > When you have the years of programming experience I have, > > feel free to throw them down the drain if you choose to. [quoted text clipped - 4 lines] > is more than the syntax you choose to use. With your experience I thought > you'd appreciate that... Hi,
Most of the time I use VB.NET but I am used to read code examples in C# and convert them using converters with no problems. One of the things that made me think about this was Convert.ToString function. Last week I was trying to fill a class with dataset values so I was using Convert. ...
The function wasn't converting NULL values ... I ended up using a Convert Wrapper Class. But the solution in C# was much more straight forward.
I feel that for web site rapid development VB.NET is best. But if I want to create classes for redistribution or self use maybe C# is a better option ...
In relation to difference between C# and VB.NET users I believe if there is a difference is maybe because VB.NET is easier to "read" so people in the beginning might choose VB.NET. But i don't see that one is more or less difficult to use then the other.
And after reading some comparisons between C# and VB.NET, in my opinion, VB.NET has also a few advantages.
Thanks, Miguel
sloan - 15 Oct 2007 19:12 GMT In regards to the "code samples", that is another reason I'm sticking with C#.
I'm getting into WCF pretty heavily, and pretty much every example I find is in C#.
So I'd use this as a gauge as well.
When I look for samples, do I find:
A. Mostly C# B. Mostly VB.NET C. Both at the same time (like msdn has both languages in the samples) D. About the same.
For me, it was clearly (A).
Thus I made the decision that I needed to stop "artificially translating" code for the sake of getting it into VB.Net (when I was finding nearly completed code in C#).
Granted I could always make a seperate assembly, and put the C# code in there, and then continue to develop in VB.Net.
Granted there are translators out there. But even using them takes time. And that is what I feel is my most valued commodity, my time. Even minutes.
I'm just telling you the decision I made.
I have no idea if ~your~ answer is A,B,C or D. You'll have to gauge that for yourself.
But I would use it as a consideration.
>> > When you have the years of programming experience I have, >> > feel free to throw them down the drain if you choose to. [quoted text clipped - 34 lines] > Thanks, > Miguel Juan T. Llibre - 15 Oct 2007 17:26 GMT re: !> Programming experience is more than the syntax you choose to use.
Of course.
The biological clock is still ticking, though.
Nearing 70, I tend to be wary of adopting a whole new set of rules. What's perfect for you might not be so perfect for me.
There's only so much a man can do with his life at a late stage. I'll continue to "limp along" with VB.Net, thank you.
Juan T. Llibre, asp.net MVP asp.net faq : http://asp.net.do/faq/ foros de asp.net, en español : http://asp.net.do/foros/ ======================================
>> When you have the years of programming experience I have, >> feel free to throw them down the drain if you choose to.
> With respect, I'm no Johnny-Come-Lately myself. I don't feel I threw a single thing down the drain when I went from > VB to C# rather than VB.NET. If I had to I could go back to VB.NET quite easily. Programming experience is more than > the syntax you choose to use. With your experience I thought you'd appreciate that... Aidy - 16 Oct 2007 09:27 GMT Ah, got you....you keep your money under the bed cos you don't want to learn how to use the ATM ;)
> re: > !> Programming experience is more than the syntax you choose to use. [quoted text clipped - 21 lines] >> experience is more than the syntax you choose to use. With your >> experience I thought you'd appreciate that... Juan T. Llibre - 16 Oct 2007 10:08 GMT Nah, it's just that I really like my favorite cashier.
;-)
Juan T. Llibre, asp.net MVP asp.net faq : http://asp.net.do/faq/ foros de asp.net, en español : http://asp.net.do/foros/ ======================================
> Ah, got you....you keep your money under the bed cos you don't want to learn how to use the ATM ;)
>> re: >> !> Programming experience is more than the syntax you choose to use. [quoted text clipped - 19 lines] >>> VB to C# rather than VB.NET. If I had to I could go back to VB.NET quite easily. Programming experience is more >>> than the syntax you choose to use. With your experience I thought you'd appreciate that... sloan - 15 Oct 2007 14:54 GMT It it was 1.1, I could argue some points about C# over VB.Net.
However, since VS2005, ~most of the issues have been eradicated.
Here is an article http://www.codeproject.com/dotnet/CSharpVersusVB.asp
to look at. It gives a "from a historical perspective".
There are also rebuttals to this article listed in the comments section to read as well.
Ultimately, it is up to you.
From personal expericence (very limited of course), the developers who go to C# rarely ever want to go back.
Juval Lowry in his book http://www.amazon.com/Programming-NET-Components-Juval-Lowy/dp/0596102070/ref=sr _1_2/103-6115945-3964637?ie=UTF8&s=books&qid=1192456286&sr=1-2
basically recommends:
If you're doing Rapid Development, stick with VB.Net If you're dealign with an enterprise application that will need to be maintained for a long time and extended over time, pick C#.
But it's up to you.
I think when I started C#, it was about a 4-7 week curve that I was doing everything from memory, and I wasn't typing "dim s (backspace backspace backspace backspace backspace ) string s " (As in, my memory/typing habits were broken from vb.net).
Now my 100% opinion. I find c# much much more elegant, and when I need to implement OO concepts, my mind works better in C#. (Probably because I took a java class about 8 years ago that introduced me to OO).
Good luck.
> Hello, > [quoted text clipped - 12 lines] > > Miguel Juan T. Llibre - 15 Oct 2007 15:33 GMT re: !> Here is an article !> http://www.codeproject.com/dotnet/CSharpVersusVB.asp
I really doubt the veracity of the content of any article which proclaims that :
"80% of C# programmers are good, while 80% of VB programmers are not good".
That article is quite biased...
Juan T. Llibre, asp.net MVP asp.net faq : http://asp.net.do/faq/ foros de asp.net, en español : http://asp.net.do/foros/ ======================================
> It it was 1.1, I could argue some points about C# over VB.Net. > [quoted text clipped - 48 lines] >> >> Miguel Peter Bromberg [C# MVP] - 15 Oct 2007 16:37 GMT I don't usually weigh in on this subject since it has become so old and tired. But, since I myself came to C# from years of BASIC, I'll mention a couple of items:
1) VB.NET is really an unncessary language. The Framework is written in C#, which Microsoft developed specifically to target the CLR. 2) VB.NET came about because Microsoft wasn't about to jettison 4 million classic VB developers. Unfortunately, they put in a lot of "crutches" that allowed VB-ers to perpetuate and "get away with" their bad programming habits, including leaving Option Strict and Option Explicit "off" by default. -- Peter Recursion: see Recursion site: http://www.eggheadcafe.com unBlog: http://petesbloggerama.blogspot.com BlogMetaFinder: http://www.blogmetafinder.com
> re: > !> Here is an article [quoted text clipped - 63 lines] > >> > >> Miguel sloan - 15 Oct 2007 18:21 GMT I realize he is using the old "80/20" rule without any real facts to back it up.
However, I tried to give the OP something to read, and even pointed out the "rebuttals" listed in the comments section.
It was an attempt to provide him with some more information for him to make his ultimate decision.
But yeah, the article is definately not gospel. However, I do like the historical aspects of it versus stuff like "You can't use "with" in C#", You don't have "using" in VB.net 1.1" type stuff. The history is interesting.
..
> re: > !> Here is an article [quoted text clipped - 69 lines] >>> >>> Miguel Juan T. Llibre - 15 Oct 2007 18:26 GMT re: !> The history is interesting.
It's interesting. I'll grant that.
I wish I had the time/energy to write a definitive article, on the VB.NET/C# differences, which nobody could question.
Juan T. Llibre, asp.net MVP asp.net faq : http://asp.net.do/faq/ foros de asp.net, en español : http://asp.net.do/foros/ ======================================
> I realize he is using the old "80/20" rule without any real facts to back it up. > [quoted text clipped - 76 lines] >>>> >>>> Miguel sloan - 15 Oct 2007 18:23 GMT http://reddevnews.com/columns/article.aspx?editorialsid=1862
Here is another article from redmond about the ~future of the 2 languages.
Which I believe would solidify Juval Lowy's advice that I previously mentioned.
> It it was 1.1, I could argue some points about C# over VB.Net. > [quoted text clipped - 52 lines] >> >> Miguel
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|