C# vs VB

  • Thread starter Thread starter Andy
  • Start date Start date
There are not many. You can use unsafe code with C#. That's the biggest, and
many developers don't ever need it.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.
 
They both are about 99% the same, from an IL point of view.

You can either stay with what you are comfortable with (VB.NET or C#) or
pick the other language and learn something new.
 
I won't go into a technical comparison. As the others have said, there isn't
much in it between VB and C#, but I'll just look at the market share issue.
This would affect your choice as an individual, in which skill you should
develop, or, as a company, in which language you'll be able to recruit
developers for.

VB has, I think, the most number of developers of any language in the world.
On the other hand, C# is similar to C/C++/Java/JavaScript/PHP/Perl,
etc..etc.. So, learning C# gives you an good start on most of today's heavily
used languages (particularly those used for internet development), whereas
learning VB get's you into the one language which is actually most used.

Java/C++ etc have been object oriented for a long time, and their
communities are very skilled in object oriented development. On the other
hand, VB has only recently become fully object oriented, and I would expect
that overall the community is not as skilled in OO development. However, the
VB community is very strong in Windows development (COM, ADO, ASP, etc..)

My personal preference is c#, by a long way.. :)

Regards,

Javaman
 
Pointers *are* unsafe code.

--
;-),

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.
 
Andy said:
Any good resources regarding benefitis by using C3 over VB?

/Andy

the biggest reason i've seen to use C# over VB is that C# jobs always
pay more.

and the VB syntax is so backwards I won't even touch it anymore. Any
language that says "End Sub" where a simple "}" would do is just too
crooked to use, imo.
 
I am a C# programmer and really enjoy working with it. Made the move from
VB6 and would never go to VB.NET. Having said that, I truely believe that
90% of this is learning the framework.

VB.NET does have a big advantage when working with Office automation. The
Office apps typically have a large number of optional parameters. VB.NET
supports the idea of optional parameters. C# requires that every one be
specified as System.Type.Missing.

Take a look at:

http://msdn2.microsoft.com/en-us/library/522xhsa3

-andrew
 
jeremiah johnson said:
the biggest reason i've seen to use C# over VB is that C# jobs always pay
more.

and the VB syntax is so backwards I won't even touch it anymore. Any
language that says "End Sub" where a simple "}" would do is just too
crooked to use, imo.

Funny, when I was learning C# from vb, i thought _C#_ was backwards. Who
ever thought of defining the return value of a function before the function
itself:

int SomeFunc() {}

instead of

Function SomeFunc() As Integer : End Function


crazy stuff.

Scott
 
There are no many differences, being both used on top of the .NET Framework.
As a rule of thumb, people coming from Java or C++ prefer the C# syntax and
people coming from VB6 prefer the VB.NET syntax.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 
Other VB.NET people think the same about typing ";" all the time when you
can type nothing ;-)

Once you learn the .NET Framework, the language is only a matter of syntax
preference.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 
Carlos J. Quintero said:
Other VB.NET people think the same about typing ";" all the time when you
can type nothing ;-)

While C# crowd think the same about typing _ for continuing in new line ;-)
 
While C# crowd think the same about typing _ for continuing in new line

Actually, the only thing I (myself) think about regarding typing is how to
avoid as much as possible, regardless of the syntax. It makes the code less
buggy initially. Computers make less mistakes than humans!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
A watched clock never boils.
 
Max said:
That's reason enough for me to use C#:-)

It certainly wouldn't be enough for me. There are plenty of languages
and platforms which earn bigger bucks than C#. I seem to recall that
COBOL programmers do rather well because there aren't that many people
willing to maintain COBOL any more.
 
VB.net is best fit for the following reasons:

1) You have to type less. Consider the following statements to declare a
SqlConnection

VB.net
=====
Dim mycon As New SqlConnection

Taking into consoderation intellisense and auto title case, you will have to
PRESS 17 KEYS

C#
==
SqlConnection mycon = new SqlConnection();

You have to press 26 + 2 (capital letter) = 28 keys even by using
intellisense.

And the most irritating this is, you have to remember the object name
SqlConnection (consider this for other objects whose name you might not
remember)

IsNumeric etc.
==========
You have many functions like IsNumeric, Mid etc. in VB.net which are handy.
You have to write separate function in C# for using the above. Allright you
people must be thinking that using these functions are not PURE (in terms of
..Net) , these are very very handy.

Optional Parameters
=============
VB.net supports optional parameters, but C# does not support them. Although
people might argue that you can use overloaded functions instead, these is
one catch to it. Say for example the function a hundred lines of code and the
optional parameter is just going to be used for checking in an if condition
(most optional parameters are used for that). In C# you have to do this by
overloading the function and in that process paste the hundred lines of code
again. What a waste... ?

=======
Regards,
Maruthi
=======
 
VB.net is best fit for the following reasons:

Ugh, to much bullshit for my taste. I just had to reply.

1) You have to type less. Consider the following statements to declare a
SqlConnection

VB.net
=====
Dim mycon As New SqlConnection

Taking into consoderation intellisense and auto title case, you will have to
PRESS 17 KEYS

C#
==
SqlConnection mycon = new SqlConnection();

You have to press 26 + 2 (capital letter) = 28 keys even by using
intellisense.

True, in this particular case you save a couple of characters typing.
However, programming isn't a speed contest and as such it doesn't
matter if you have to type a few more characters.

Also, try the following

C#
==
int x = 5;

VB.NET
==
Dim x As Integer
x = 5
And the most irritating this is, you have to remember the object name
SqlConnection (consider this for other objects whose name you might not
remember)

What the heck are you talking about? You have to know that it is an
SqlConnection in both vb and c#. And it is class name, not object
name.
IsNumeric etc.
==========
You have many functions like IsNumeric, Mid etc. in VB.net which are handy.
You have to write separate function in C# for using the above. Allright you
people must be thinking that using these functions are not PURE (in terms of
.Net) , these are very very handy.

For many of those methods, there are similar methods in the .Net
Framework. Also, if you are using C# and need access to a specific vb
method, you can also include the vb.dll in the project. This is much
better than forcing a bunch of methods into the language
specification.
Optional Parameters
=============
VB.net supports optional parameters, but C# does not support them. Although
people might argue that you can use overloaded functions instead, these is
one catch to it. Say for example the function a hundred lines of code and the
optional parameter is just going to be used for checking in an if condition
(most optional parameters are used for that). In C# you have to do this by
overloading the function and in that process paste the hundred lines of code
again. What a waste... ?

Paste hundreds of lines of code???????

public void LongMethod(int optionalParameterThatDefaultsToTen)
{
.....
}

public void LongMethod()
{
LongMethod(10);
}

I count 4 lines, and if you are really sensitive about space you could
always do it like this.

public void LongMethod(){ LongMethod(10); }
 

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

Back
Top