VB.NET vs C#

S

shapper

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
 
M

Mark Rae [MVP]

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...
 
A

Aidy

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.
 
M

Mark Rae [MVP]

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...
 
J

Juan T. Llibre

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/
======================================
 
M

Mark Rae [MVP]

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>
 
S

sloan

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-N...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.
 
A

Aidy

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.
 
A

Aidy

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...
 
S

shapper

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...

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
 
G

Guest

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
 
J

Juan T. Llibre

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/
======================================
 
S

sloan

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.


...
 
J

Juan T. Llibre

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/
======================================
 
S

sloan

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.
 
A

Aidy

Ah, got you....you keep your money under the bed cos you don't want to learn
how to use the ATM ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top