what are advantages of C#?

redss

Member
Joined
Sep 30, 2003
Messages
15
Trying to convince coworkers to go with C# instead of VB.net...

What are some things that C# supports that have no equivalent in VB.net?
 
Some operator overloading, and inline support for XML documentation, and thats about it. C# and VB.NET both compile to exactly the same MSIL bytecode underneath (more or less) anyway. One huge advantage is does have though is that it doesnt include all the VB backwards compatability stuff, so you dont have to worry about doing things the "right" way.

However, if he knowns what he is doing, theres no reason he should choose one over the other. If he is just learning, however, he should probably go with C#, since it has less room to be sloppy.
 
Id only add that you should take into consideration your current employees that do development. If they already know VB, they should be a bit better off at knowing the syntax. If they dont know VB or C# then Id lean towards C# as it seems a more "accepted" .NET language, though there arent really enough differences to justify an argument that either language is really better.

If your coworkers arent developers, I wouldnt listen to them quite as much unless their opinions are needed for other reasons, developer related. For instance, if my boss werent a developer and we had no plans on giving our sourcecode away or sharing with a 3rd party, then he should be going off my opinion of which language to use and not dictate it.

I think I saw a thread awhile back in the Random Thoughts forum that discussed the main differences between VB.NET and C# (VolteFace listed some). Id search there as well, if it helps.

-Ner
 
Mike Bailey, I disagree. I think C# is easier to learn. It just seems more logical to me and the best part- its much less wordy.
 
Personally I found that when I first started to learn VB.Net I was always thinking VB6, I approached problems with a VB6 mentality and my code ended up sprinkled with Format$ , Left$ , Chr$ , MsgBox etc.
Switching to C# just made me think in a more .Net way. Now I find either language pretty similar and once you know your way round the framework the differences are almost negligible.
 
When it comes down to it, whether you choose VB.NET or C# is pretty much person preference. The only real advantage C# would have over VB.NET is the capability to use pointers. But lets be realistic, how often would you actually need to? Never in most cases.
 
Yeah, as I understand it, you have access to all the same VB6 style functions (Format$ , Left , Chr, Mid etc) in C# as well as VB (through VisualBasic.dll) , but there are better C#-like ways to accomplish the same things. I read somewhere that many of the VB functions are somewhat more bloated versions of the same calls that C# uses, but youd have to use a disassembler to find that out.
 
I can say this, if you look around in here, all the newbie, all the beginner questions are people working with VB; any question in here that are above how do I open a form (on a side note... should people who cant figure this out on their own even be programming?!!! I mean there is such a thing as a help file!)... but I digress... anything above terrible simple that represents an actual problem you find 9 times out of 10 are people writing in C# or someone who knows C# but is using VB for such wonderful shortcuts as doing late-binding easily. C# is not only more accepted as a real language, but more out there is C based; if you know one C language, JavaScript, C++, and the like arent that far off. And like I read above, C# is more intuitive, and in my opinion really seperates the men from the boys.
 
No. C# is primarily used by people comming across from a C background. VB.Net is used by both people comming across from a VB background - and rank newbs.

Thats why u get the silly questions relating to VB more so then C#.

VB.Net has the advantage of having code that is easier to understand from a newb point of view.
 
I would like to comment on this thread because one of my projects is currently forcing me to write in Visual Basic.Net, and I dont like it.

I used to be a starch advocate for VB.net and was under the impression that I would not care to learn C#.net nor ever need to because "VB.Net is now a respected language that can do anything that C# can do" The fact of the matter is that VB.net, as long as it does not force a strict syntax (option strict on), is not a real language in my opinion, and, furthermore, is ten times harder to interpret when someone is just randomly dimming variables all over the place with no object associations. I cant stand sloppy code, and I really dont want to read your code to see what the hell you were really dimming when you say
[VB]
Dim myVariable
[/VB]

The syntax of C# is much more organized, is easier to read, and is much more accurate. Case in point, consider the following:

[CS]
int myInt = 0;
[/CS]

vs.
[VB]
Dim myInt as Integer = 0
[/VB]

now in C#, I know I made an int called myInt and set the value to 0, whereas in Vb I did the same thing, but it looks like Im saying Integer = 0, which we all know is rediculous.

To assist also in reading, I find brackets much easier to keep in track than a bunch of text that says End Try End Sub End Class and is not really that easy to skim over. The language in VB.net is way to verbose, you usually have to write twice as many words to accomplish the same thing in vb.net that you would do in c#, which in my opinion, also clutters code.

Oh, and dont forget about block coding!
case in point:
[VB]

In order to comment multiple lines
I have to put ticks in front of each
Then when I go to remove them later
I have to do it line by line
It sucks!
[/VB]

whereas in C#
[CS]
/*
the block comment
allows for a lot easier commenting of multiple
lines, and when I go to remove
the comment, I dont have to
do it line by line
*/
[/CS]

I learned how to program in C++, but switched to VB6 for profession because of its RAD. Now I have the pure pleasure of being able to return to a much more complete language with all the benefits of RAD.

For sake of not running on and on, Im going to end here. I have simply covered the aspects of syntax that I feel are so much better in C#.
 
One thing that should have been set on by default in VB.NET is Option Strict and Option Explicit, I pretty much refuse to help people that do not set these.

As far as C# or VB.NET, I dont care which I use, theyre both perfect.
 
Personal feelings and minor language oddities (Option Strict) aside, theyre both equally useful and productive. I have yet to see evidence that says one language is superior to the other, which is what this thread is about.
 
Actually i think this thread is about is a C# fan, desparately trying to stick to what he knows and not too learn something new.

Where personally when i have a good knowledge in one area, i like to learn area.
 
Well as I started this thread, I can say its about finding out what one language can do that the other cant. I like VBs superior intellisense and I dislike C#s case sensitivity (well I dont mind case sensitivity in general but who the heck came up with the idea of capitalizing the FIRST letter of all the commonly functions? that convention is totally unintuitive and unheard of in all the languages Ive worked in previously, not to mention that intellisense only works if you remembered to capitalize correctly!) Probably my biggest argument for using C# (besides a preference for it other than my above gripes) is a salary survey I read that stated that C# programmers are being paid quite a bit more than VB.NET programmers, even though the languages are now effectively just about equal.
 
Originally posted by Robby
One thing that should have been set on by default in VB.NET is Option Strict and Option Explicit...

Actully, you can set them on by default. Its in the Tools>>Options dialog. Theres a "folder" called Projects and theres a VB Defaults selection for Strict (on/off), Explict (on/off) and Compare (binary/text). I use strict and explicit on (as it should be...). I do agree that you shouldnt be able to turn them off through.

Since were talking about C# vs VB, I am, mainly, a VB guy but I am learning C# currently as well. While I think that both langauges are pretty much equal, having a good knowledge of both makes you much more marketable (in my opinion). I also agree that C#s intellesense is stinky poo-poo! :)

[putting soap box away...]
 
Last edited by a moderator:
I totally agree that knowing both will make a person more marketable, and with the fact that now both languages can essentially do the same thing, it may become a necessity. Besides, as developers we should have an inherent desire to learn more languages and not confine ourselves to only one schema.

I have a friend who is interviewing for a new job and we were discussing this just last night, about how some developers let take a job for more money, but get stuck with one type of technology and then assume that their way of doing things is the only way to do things. For instance, the question of "how do you comment code" or the question of "how many lines of code should you have in each class" might come up from a locked-in developer, but really these questions are completely invalid as to the level of skill of a developer, plus the fact that now you cant possibly answer the question correctly in their mind. Anyway, I digress.

I also agree that you should not be able to turn Option Strict off in VB.

I also agree that intellisense in C# is very limited, especially compared to VBs intellisense, however this is not always a bad thing. I like the fact that I have to think about things every now and then, as it helps me to retain the information, rather than rely on the IDE (which can also have its advantages) but I hate typing the entire line MessageBox.Show("X"); everytime I want to output a message.
 
Back
Top