473,473 Members | 1,739 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Advantage over VB ?

Is there any advantage in C# over VB.NET ? Or the difference is only syntax
? Can anything done in C# which cannot be done in VB.NET?
Nov 16 '05 #1
13 5125

Debugging is easier in C# beause C# provides an $exception variable on
unhandled exceptions. In VB.NET you ahve to catch the exception to
inspect exception details. This poses a problem as catching the
exception also means the scope is changed from where the exception
actually occured to now be where the exception is caught, leaving
local variables and general object state information unavailable. I
haven't seen this problem discussed at all and when I brought it up in
the VB.NET group it was brushed off as a non-issue. To me this is
enough of a reason to use C#.

Another advantage is the availability of unsafe code blocks in C#. If
you don't use them, then they're not an advantage though.

VB.NET also has serious problems with binary serialization of objects
that have events since attributes can not be applied to the
compiler-generated event fields. The only work-around is to have the
events declared in a separate object, possibly implying use of memento
for serialization. This is fixed in .NET 2.0 but the fix requires a
significant amount of code (20-30 lines) whereas only 1 line is needed
in C# (the attribute).

There are also lots of stylistic, syntax, and IDE differences but they
pose no real problems and are simply a matter of personal preference.

HTH,

Sam
On Fri, 4 Mar 2005 01:32:35 +0500, "Arsalan"
<ar***********@hotmail.com> wrote:
Is there any advantage in C# over VB.NET ? Or the difference is only syntax
? Can anything done in C# which cannot be done in VB.NET?


B-Line is now hiring one Washington D.C. area VB.NET
developer for WinForms + WebServices position.
Seaking mid to senior level developer. For
information or to apply e-mail resume to
sam_blinex_com.
Nov 16 '05 #2
More talking points:

VB.NET lacks C#'s "using () {}" code block, which I find -- ahem --
indispensable for dealing with IDispoable objects. I really miss it when I
have to code in VB.NET.

C# is case sensitive, whereas VB is case-insensitive. There are endless
religious debates about which is better. I came to C# from a
case-insensitive language (Visual FoxPro) and at first found case
sensitivity a slight annoyance, but quickly adapted. After being thrust
recently into a VB.NET project two years later, I am finding case
insensitivity to be *more* of an annoyance (though still not a huge deal).
Your mileage may vary.

There are two things that VB.NET has over C# that I rather like. One is
With / End With -- some C# people think this is evil incarnate, but I
personally like this syntax sugar (and yes, we had it in VFP too). That
said, in C# it's no big deal to achieve all the performance advantages of
With / End With, if not 100% of the compactness, by simply assigning a
lengthy hierarchical reference to a short variable name and using that going
forward.

The other thing that VB.NET has that C# lacks is optional parameters.
Again, you can acheive almost the same things in C# with overloading, but
optional parameters really makes some Interop work -- especially ActiveX
Automation -- much less tedious and error-prone to code.

Since I haven't had the need for it yet, for me the jury is still out on
VB.NET and Option Strict Off (support for late binding that does a lot of
tedious calls into System.Reflection on your behalf). In theory this should
make some late binding work easier, but I haven't actually had to do it yet
and wonder if it's one of those features where I'd end up doing it myself it
I wanted it done right.

Which brings us to the ethos of VB.NET, which is to try to do as much detail
work for you as possible by default, vs C#, which tends to make fewer
assumptions about what you are trying to accomplish. Both approaches can
get in the way of getting things done, depending on the context. Again, in
my view, really a wash, but I moderately favor C#'s hands-off approach; I
don't like to be second-guessed.

There is always the religious debate about verbosity / clunkiness of VB.NET
vs the terseness / elegance of C#. I personally have a distinct preference
for C-style syntax, at least of the Java or C# persuasion as opposed to the
underscore and macro infested crap that a lot of C++ code appears to be.
But, although coding in VB.NET makes me grimace a little from time to time,
it's not that big of a deal. It is what it is.

VB.NET has some legacy baggage to support VB6 and prior, that C# was able to
avoid. For example if you are an old VB6 warhorse you would probably use
CInt(obj) or CType(obj,Integer) rather than Convert.ToInt32(), and if you
are a multi-language .NET developer you would probably favor the inverse.
Though this does create some extra learning curve if you don't have a VB
background, it is in fact once again a minor deal. And after a couple more
releases, C# will have legacy baggage of its own anyway, so its lead in this
division of the elegant / clean competition is fairly temporary.

Two final deciding factors in favor of C# for me:

1) While MSFT is clearly committed to VB.NET, C# is just as clearly MSFT's
favored child. It was created specifically for .NET, and although things
have gotten better lately, there was an early tendency for the best examples
and newest toys to be C#-only. Indeed, new features have been promised for
C# first, and for VB.NET at some undefined future date; for a long time it
was not promised or certain that generics would make their way into VB.NET
with version 2.0. Ultimately it did, but the fact that the VB community had
to agitate for it is telling. So I like C# because it seems to have a
moderately favored status with its maker (although some third party vendors
favor VB.NET; for example IronSpeed Designer only generated VB.NET code
until recently).

2) Politics. There is a 99% bogus, yet persistent, perception abroad in the
world that VB.NET is a "toy" language and/or that it is not for "serious"
projects (whatever precisely those might be) and/or tends to attract less
skilled developers. Conversely there is a 99% bogus, yet persistent,
perception abroad in the world that C# is an "adult" language and/or that it
is more elegant / faster / better / grows hair on your chest and/or attracts
the better developers. I call it the Curly Brace Effect ("my God, Edna, if
he can read that stuff he *must* be a genius!"). No one ever kicks sand
into your face for being a C programmer (be it Java, C#, or especially C++).
On the other hand you can be fairly readily dismissed for being a VB
programmer. Unfair, but true. So for pure marketability to pointy-haired
bosses who think the language is the key to everything, I position myself as
a C# developer.

Of course in reality no one is a C# or VB.NET or Eiffel.NET developer; we
are all .NET framework developers with a favorite language.

--Bob

"Samuel R. Neff" <bl****@newsgroup.nospam> wrote in message
news:9q********************************@4ax.com...

Debugging is easier in C# beause C# provides an $exception variable on
unhandled exceptions. In VB.NET you ahve to catch the exception to
inspect exception details. This poses a problem as catching the
exception also means the scope is changed from where the exception
actually occured to now be where the exception is caught, leaving
local variables and general object state information unavailable. I
haven't seen this problem discussed at all and when I brought it up in
the VB.NET group it was brushed off as a non-issue. To me this is
enough of a reason to use C#.

Another advantage is the availability of unsafe code blocks in C#. If
you don't use them, then they're not an advantage though.

VB.NET also has serious problems with binary serialization of objects
that have events since attributes can not be applied to the
compiler-generated event fields. The only work-around is to have the
events declared in a separate object, possibly implying use of memento
for serialization. This is fixed in .NET 2.0 but the fix requires a
significant amount of code (20-30 lines) whereas only 1 line is needed
in C# (the attribute).

There are also lots of stylistic, syntax, and IDE differences but they
pose no real problems and are simply a matter of personal preference.

HTH,

Sam

Nov 16 '05 #3
Thanks for everyone for posting their opinion
"Arsalan" <ar***********@hotmail.com> wrote in message
news:ue**************@TK2MSFTNGP14.phx.gbl...
Is there any advantage in C# over VB.NET ? Or the difference is only
syntax ? Can anything done in C# which cannot be done in VB.NET?

Nov 16 '05 #4
Bob Grommes <bo*@bobgrommes.com> wrote:
More talking points:
<snip - superb points for the most part>
2) Politics. There is a 99% bogus, yet persistent, perception abroad in the
world that VB.NET is a "toy" language and/or that it is not for "serious"
projects (whatever precisely those might be) and/or tends to attract less
skilled developers. Conversely there is a 99% bogus, yet persistent,
perception abroad in the world that C# is an "adult" language and/or that it
is more elegant / faster / better / grows hair on your chest and/or attracts
the better developers.


I would argue that there are a number of ways in which C# genuinely
*is* more elegant, mostly because it doesn't have the baggage you
mentioned earlier. (And while I agree that going forward it will end up
having "earlier version baggage" I don't think there'll be nearly as
much - partly because VB is a much larger language than C#.)

I'm thinking of things like the way that C# doesn't let you access a
static member via a variable - so while in VB I could create a new
thread and call:

t.Sleep(5000)

C# would disallow this, forcing you to write

Thread.Sleep(5000) instead.

The VB.NET version is unclear - if you didn't know the framework well,
you might think it's telling the other thread to sleep for 5 seconds,
rather than the current thread.

The ability in VB.NET to pass properties by reference, which generates
"copy into temporary variable, pass temp variable by reference, copy
out of temp variable" code is another example - it's just *nasty* to
hide things like that and make it look like passing a property by
reference is the same as passing a variable by reference, when they end
up having very different semantics.

While there are certainly flaws, C# is a very, very elegant language in
general. I think it really is reasonable to say it's more elegant than
VB.NET. (The "attracts the better developers" idea is an interesting
one. I have no idea whether that's true or not, and I suspect no-one
else does either. It would be interesting to know though.)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #5
Aralan,

Asking this question in this newsgroup is asking to somebody who rides a
BMW, if there advantages from a BMW above a Mercedes.

What do you think that the answer will be?

Cor
Nov 16 '05 #6
Good question, but you cant disagree, VB.NET lacks feature according the
reply to this thread.
Most VB users are not 'Pro' programmer, where as ppl who r using C# r those
ppl who've migrated from VC or Java.

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uk**************@TK2MSFTNGP12.phx.gbl...
Aralan,

Asking this question in this newsgroup is asking to somebody who rides a
BMW, if there advantages from a BMW above a Mercedes.

What do you think that the answer will be?

Cor

Nov 16 '05 #7
Seriously WRONG statement! "Most VB users are not 'Pro' programmers,"?
What are you basing that statement on?

I know plenty of 'Pro' Vb programmers both VB6 and VB.NET.

I program in both VB.NET and C# and the apps we generate are professional
level and mission critical in both languages.

Just because C# has some features that VB doesn't have, does not a better
language make. VB.NET also has features that C# does not have.

Remember one thing when asking the question you posted originally here;

C# programmers are not old school C# programmers. They are C, C++ or Java
programmers who have switched to C#. There will always be a bias towards C
based languages on their part.

That question has been discussed at length so many times in the past and can
only be answered in a simple manner. The best language is one that will do
what you want it to do. Neither is 'best'. They are both programming
languages that allow you to develop software for execution on a computer.

--
Gerry O'Brien
Visual Basic.NET MVP
"Arsalan" <ar***********@hotmail.com> wrote in message
news:Op**************@TK2MSFTNGP09.phx.gbl...
Good question, but you cant disagree, VB.NET lacks feature according the
reply to this thread.
Most VB users are not 'Pro' programmer, where as ppl who r using C# r
those ppl who've migrated from VC or Java.

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uk**************@TK2MSFTNGP12.phx.gbl...
Aralan,

Asking this question in this newsgroup is asking to somebody who rides a
BMW, if there advantages from a BMW above a Mercedes.

What do you think that the answer will be?

Cor


Nov 16 '05 #8
Gerry,

It is probably a true statement.

"Most VB users are not 'Pro' programmers,"?

Read it again.

However there are many VB users and that are not only 'Pro' programmers.

It is not impossible that there are more 'Pro' programmers who use VB (every
dialect) than there are 'Pro' programmers who don't use that.

However, I think as well that it was not what the OP was meaning

:-)

Cor
Nov 16 '05 #9
I don't even remember the number of VB programmers world wide so it will be
hard to determine percentages.

Another question might be, "How do you determine if a programmer is Pro"?
--
Gerry O'Brien
Visual Basic.NET MVP
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Gerry,

It is probably a true statement.

"Most VB users are not 'Pro' programmers,"?

Read it again.

However there are many VB users and that are not only 'Pro' programmers.

It is not impossible that there are more 'Pro' programmers who use VB
(every dialect) than there are 'Pro' programmers who don't use that.

However, I think as well that it was not what the OP was meaning

:-)

Cor

Nov 16 '05 #10
:-) Not meant to offend anyone. Looks like VB guys r on FIRE
"Gerry O'Brien" <gk******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I don't even remember the number of VB programmers world wide so it will be
hard to determine percentages.

Another question might be, "How do you determine if a programmer is Pro"?
--
Gerry O'Brien
Visual Basic.NET MVP
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Gerry,

It is probably a true statement.

"Most VB users are not 'Pro' programmers,"?

Read it again.

However there are many VB users and that are not only 'Pro' programmers.

It is not impossible that there are more 'Pro' programmers who use VB
(every dialect) than there are 'Pro' programmers who don't use that.

However, I think as well that it was not what the OP was meaning

:-)

Cor


Nov 16 '05 #11
Man you're the Boss, whatever you say is right, I'm wrong, r u happy now.
"Gerry O'Brien" <gk******@hotmail.com> wrote in message
news:OY**************@TK2MSFTNGP12.phx.gbl...
Seriously WRONG statement! "Most VB users are not 'Pro' programmers,"?
What are you basing that statement on?

I know plenty of 'Pro' Vb programmers both VB6 and VB.NET.

I program in both VB.NET and C# and the apps we generate are professional
level and mission critical in both languages.

Just because C# has some features that VB doesn't have, does not a better
language make. VB.NET also has features that C# does not have.

Remember one thing when asking the question you posted originally here;

C# programmers are not old school C# programmers. They are C, C++ or Java
programmers who have switched to C#. There will always be a bias towards
C based languages on their part.

That question has been discussed at length so many times in the past and
can only be answered in a simple manner. The best language is one that
will do what you want it to do. Neither is 'best'. They are both
programming languages that allow you to develop software for execution on
a computer.

--
Gerry O'Brien
Visual Basic.NET MVP
"Arsalan" <ar***********@hotmail.com> wrote in message
news:Op**************@TK2MSFTNGP09.phx.gbl...
Good question, but you cant disagree, VB.NET lacks feature according the
reply to this thread.
Most VB users are not 'Pro' programmer, where as ppl who r using C# r
those ppl who've migrated from VC or Java.

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uk**************@TK2MSFTNGP12.phx.gbl...
Aralan,

Asking this question in this newsgroup is asking to somebody who rides a
BMW, if there advantages from a BMW above a Mercedes.

What do you think that the answer will be?

Cor



Nov 16 '05 #12
No, we're just always this way because we have to defend our language.

Gerry
"Arsalan" <ar***********@hotmail.com> wrote in message
news:OX**************@TK2MSFTNGP14.phx.gbl...
:-) Not meant to offend anyone. Looks like VB guys r on FIRE
"Gerry O'Brien" <gk******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I don't even remember the number of VB programmers world wide so it will
be hard to determine percentages.

Another question might be, "How do you determine if a programmer is Pro"?
--
Gerry O'Brien
Visual Basic.NET MVP
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Gerry,

It is probably a true statement.

"Most VB users are not 'Pro' programmers,"?

Read it again.

However there are many VB users and that are not only 'Pro' programmers.

It is not impossible that there are more 'Pro' programmers who use VB
(every dialect) than there are 'Pro' programmers who don't use that.

However, I think as well that it was not what the OP was meaning

:-)

Cor



Nov 16 '05 #13
I'm just tired of people putting down VB due to a lack of knowledge of the
language. If the VB people don't set the other straight, how people like
yourself know the difference?

If you are new to programming, the VB.NET and C# share the same learning
curve. Therefore the language chosen will more than likely be based on
questions like the OP asked. Which is better?

My answer at the end of my response is valid and true.

I said you were wrong quite simply because your statement sounds so much
like someone who knows very little about how VB.NET is being used. Your
statement is the same as that made by C and C++ programmers so many times.
VB is a toy language for hobby programmers and you can't do any serious
development with it. That is the reputation that VB has and it is wrong to
continue that. I'm merely pointing that out.

Gerry
"Arsalan" <ar***********@hotmail.com> wrote in message
news:Ow**************@TK2MSFTNGP10.phx.gbl...
Man you're the Boss, whatever you say is right, I'm wrong, r u happy now.
"Gerry O'Brien" <gk******@hotmail.com> wrote in message
news:OY**************@TK2MSFTNGP12.phx.gbl...
Seriously WRONG statement! "Most VB users are not 'Pro' programmers,"?
What are you basing that statement on?

I know plenty of 'Pro' Vb programmers both VB6 and VB.NET.

I program in both VB.NET and C# and the apps we generate are professional
level and mission critical in both languages.

Just because C# has some features that VB doesn't have, does not a better
language make. VB.NET also has features that C# does not have.

Remember one thing when asking the question you posted originally here;

C# programmers are not old school C# programmers. They are C, C++ or
Java programmers who have switched to C#. There will always be a bias
towards C based languages on their part.

That question has been discussed at length so many times in the past and
can only be answered in a simple manner. The best language is one that
will do what you want it to do. Neither is 'best'. They are both
programming languages that allow you to develop software for execution on
a computer.

--
Gerry O'Brien
Visual Basic.NET MVP
"Arsalan" <ar***********@hotmail.com> wrote in message
news:Op**************@TK2MSFTNGP09.phx.gbl...
Good question, but you cant disagree, VB.NET lacks feature according the
reply to this thread.
Most VB users are not 'Pro' programmer, where as ppl who r using C# r
those ppl who've migrated from VC or Java.

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uk**************@TK2MSFTNGP12.phx.gbl...
Aralan,

Asking this question in this newsgroup is asking to somebody who rides
a BMW, if there advantages from a BMW above a Mercedes.

What do you think that the answer will be?

Cor



Nov 16 '05 #14

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

Similar topics

4
by: Siemel Naran | last post by:
Hi. I have found one advantage of returning values through the argument list. It's that we have to store the return value. But when we return by value, we may forgot to store the return value. ...
2
by: Tony Johansson | last post by:
Hello experts! My question is what advantage and disadvantage have public inheritance. The answer that I have to this is that sometimes it is an advantage to let a client have access to...
1
by: David Horowitz | last post by:
Hi folks. I'm trying to connect to a Medisoft Advantage SQL db through SQL Server using OpenDataSource or OpenRowSet. I have general connections to the db working fine, but not with OpenDataSource...
11
by: Rajesh | last post by:
Dear All, Please let me know the advantage of function pointer? Is it fast calling function using function pointer? Is it possible to use function pointer to optimise code? Thanks and regards...
2
by: Samuel R. Neff | last post by:
What's the advantage of inheriting from CollectionBase as opposed to just implementing IList? It seems that it saves you from having to implement a few properties (Clear, CopyTo, Count,...
3
by: yinglcs | last post by:
I am reading the Boost scoped_ptr library, and I wonder what is the advantage of using that. Here is an example from Boost.org web site: #include <boost/scoped_ptr.hpp> #include <iostream> ...
30
by: junky_fellow | last post by:
I was looking at the source code of linux or open BSD. What I found that lots of typedefs were used. For example, consider the offset in a file. It was declared as off_t offset; and off_t is...
19
by: ahjiang | last post by:
hi there,, what is the real advantage of boxing and unboxing operations in csharp? tried looking ard the internet but couldnt find any articles on it. appreciate any help
13
by: Sarath | last post by:
What's the advantage of using for_each than the normal iteration using for loop? Is there any 'tweak' to use stream objects as 'Function' parameter of for_each loop. Seems copy function can do...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.