473,230 Members | 4,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,230 software developers and data experts.

Which is better, C# or VB, and why?

i've been researching this issue for a while and can't come to any conclusive
answer, mostly it seems to be a preference over syntax, some saying c# is
elegant while vb is clunky, or that c# is geeky while vb is more naturally
legible. there dont seem to be many capabilities in one over the other, at
least with whidbey, so basically, is there anything c# can do that vb can't?
Jul 21 '05 #1
6 2097

"lastusernameleft" <la**************@discussions.microsoft.com> wrote in
message news:F4**********************************@microsof t.com...
i've been researching this issue for a while and can't come to any
conclusive
answer, mostly it seems to be a preference over syntax, some saying c# is
elegant while vb is clunky, or that c# is geeky while vb is more naturally
legible. there dont seem to be many capabilities in one over the other, at
least with whidbey, so basically, is there anything c# can do that vb
can't?


Each language has a few, little things different. In 1.x VB has its
dynamically bound mode when option strict is off and has access to a few
little things like parameterized properties(I believe) while C# has support
for pointers, unsigned tyupes, and operator overloading.

In whidbey, VB added operator overloading and direct supprot for unsigned
types as well as some other niceties(like OrElse and AndAlso, IIRC), but the
languages actually diverged just a little bit moreso than they were. Both
got generics and partial types, but much of the VB effort went into things
like Edit&Continue(C# basically hopped on that bandwagon pretty late), the
My namespace, and the things I mentioned before while C# added a few little
thigns like anonymous methods that are close to closures and iterators.

I think anon methods are the only thing I'd consider an advantage. Iterators
are nice but IEnumerable\IEnumerator implemetnations are not *that* hard to
write manually. Out side of that I don't see much advantage except for
personal preference or in very specific circumstnaces(C# for pointer ridden,
native code or VB for rich COM work, office automation for example)
Jul 21 '05 #2
C# can use the unsigned integer data types, and you can code 'unsafe' code
blocks. If you need these features, you already know it. Most people never
have a need for them.

VB.Net is better at late binding, which is sometimes very useful if you need
to interact with certain external applications such as MS Office. C# can do
it, of course, but it takes more code. If you turn Option Strict on in
VB.Net, as you should, it's just as good about insisting on data type
matching as C# is.

VB does background compiles and is quicker at showing you coding errors
(keep the task list window visible and you get immediate feedback). If you
have extremely large solutions and your processor isn't fast, this can
sometimes slow down editing responsiveness. C#, on the other hand, doesn't
show you most errors until you compile.

Performance will be the same (provided you avoid the
VisualBasic.Compatibility assembly, which is supplied as a crutch for people
trying to use the upgrade wizard in bringing code up from VB6). The wizard
is almost universally considered to be pretty much useless.

Other than that, there's not much else to choose between them. If you like
curly braces and case-sensitivity, you'll like C#. If you came from a VB 6
background and like not not having to match the case of variables and so
forth when you type, you'll like VB.Net. You still have to spell the names
correctly, but VB.Net is relaxed about matching case. The casing in the
declarations rules throughout the code, and the editor will correct the
casing for you after you edit past the line. VB.Net is a little more
verbose: Begin's, Then's, End If's, and so forth instead of curly braces,
but if you're a skilled touch typist this isn't much of a deal.

Some people seem to think that C# code looks 'cleaner', which is really an
issue of aesthetics. The compilers don't care, but there's no reason why you
shouldn't take that into account if you agree and have the freedom to make
your decision on that basis. I tend, myself, to agree with that sentiment,
but not to the extent that I let it limit my options.

There's a contingent of C# programmers who tend to look down their noses at
people who program in VB.Net. If this is going to bother you, and in my
opinion it's their problem, not that of the VB.Net programmers, you might
want to gravitate to C#. They can be a little savage, but mostly they rant
about it among themselves rather than taking it to the streets ;-)

There's seems to be a little evidence that on average C# programmers might
get slightly higher salaries. This is probably tied to a perceived notion
that C# programmers are somehow smarter or better than VB.Net programmers
(here, of course, I'm talking about professional programmers, not
hobbyists).

Whatever you do, learn both languages, regardless of which one you decide to
use (or have decided for you by someone else). Someone with a computer
science background should be able to pick up a new language in no more than
three days or so. Mastering the framework class library will be the biggest
hurdle you have to face, and that effort will be the same no matter which
language you settle on.

Where do I come down on this personally? I was a happy C/C++ programmer long
before VB came out in 1991. Over the years I moved into VB programming,
starting with VB 1.0 and going up through VB 6, writing less and less helper
code in the C language family as VB grew up. When I moved into .Net, I
started out programming in both, leveraging my familiarity with both
language families. If I happened to pick up a code sample that exercised
something in the framework I wanted to learn about, I just continued in the
language of the sample. If I start a new project from scratch, I usually
start it out in C#.

The company I'm working for now made the decision, before I joined them,
that they would develop in VB.Net, so that's what I use, without complaint,
when I'm programming for them.

HTH,
Tom Dacon
Dacon Software Consulting

"lastusernameleft" <la**************@discussions.microsoft.com> wrote in
message news:F4**********************************@microsof t.com...
i've been researching this issue for a while and can't come to any conclusive answer, mostly it seems to be a preference over syntax, some saying c# is
elegant while vb is clunky, or that c# is geeky while vb is more naturally
legible. there dont seem to be many capabilities in one over the other, at
least with whidbey, so basically, is there anything c# can do that vb

can't?
Jul 21 '05 #3
Off the top of my head:

C# allows:
- 'unsafe' pointer code if you're inclined that way.
- assignments within expressions (e.g., while ((i = s.IndexOf(y)) > -1))
- allows anonymous methods - I don't believe VB will include that in 2005.

VB allows:
- types within interfaces.
- the "With" construct (but it's value is debatable).
- a shorthand for array resizing while preserving contents (ReDim Preserve),
but you can do it in C# also with 4 lines of code.
- this is pretty trivial, but VB has the "When" clause for Catch statments,
which has no elegant C# equivalent.

David Anton
www.tangiblesoftwaresolutions.com
Home of:
Instant C#: VB.NET to C# Converter
Instant VB: C# to VB.NET Converter
Instant J#: VB.NET to J# Converter

"lastusernameleft" wrote:
i've been researching this issue for a while and can't come to any conclusive
answer, mostly it seems to be a preference over syntax, some saying c# is
elegant while vb is clunky, or that c# is geeky while vb is more naturally
legible. there dont seem to be many capabilities in one over the other, at
least with whidbey, so basically, is there anything c# can do that vb can't?

Jul 21 '05 #4
Tom,

I have saved this link for future use for this question.

http://groups-beta.google.com/group/...cce63bb7?hl=en

:-)

Cor
Jul 21 '05 #5
David,

Because you are name them, in that row has to be as well in my opinion

VBNet has a very elegant Switch statement (select case)

Cor
Jul 21 '05 #6
Another thing C# gives you is XML documenting. I hope VB.NET will give
you this sooner or later!

Jul 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Amit D.Shinde | last post by:
Hello Experts.. I need some help regarding cookies and session objects and also global.asa file I am creating one cookie when a user logs in on my website. The cookie stores the login name of...
1
by: Markus Rebbert | last post by:
Hi list, i got an postgresql installation on linux (debian) with the htree partitions: 1- system 2- postgresql data files 3- postgresql WAL logs(pg_xferlog) Our standard file system is...
4
by: Ed Davis | last post by:
I'm trying to decide which of the following programming styles is better, as in easier to understand, and thus easier to maintain. Keep in mind that for posting purposes, this is a greatly...
9
by: Robert Lario | last post by:
C# verses VB.Net Which Way to go. I am sure this issues has come up before. Please direct me to any good articles that cover this issue. Ideally some neutral assessment.
22
by: smartwolf agassi via DotNetMonster.com | last post by:
I'm a C# language learner. I want to know which IDE is better for C# programing, Borland C#Builder or VS.net 2003? -- Message posted via http://www.dotnetmonster.com
12
by: lastusernameleft | last post by:
i've been researching this issue for a while and can't come to any conclusive answer, mostly it seems to be a preference over syntax, some saying c# is elegant while vb is clunky, or that c# is...
2
by: monkeydragon | last post by:
Which is better, using ReadFile/WriteFile or use fstream?
33
by: Protoman | last post by:
Which is better for general-purpose programming, C or C++? My friend says C++, but I'm not sure. Please enlighten me. Thanks!!!!!
20
by: mike3 | last post by:
Hi. (Xposted to both comp.lang.c++ and comp.programming since I've got questions related to both C++ language and general programming) I've got the following C++ code. The first routine runs in...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.