what are advantages of C#?

redss

Newcomer
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 that's 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 doesn't include all the VB backwards compatability stuff, so you don't have to worry about doing things the "right" way.

However, if he knowns what he is doing, there's 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.
 
I'd 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 don't know VB or C# then I'd lean towards C# as it seems a more "accepted" .NET language, though there aren't really enough differences to justify an argument that either language is really better.

If your coworkers aren't developers, I wouldn't listen to them quite as much unless their opinions are needed for other reasons, developer related. For instance, if my boss weren't 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). I'd 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- it's 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 let's 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 you'd 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 can't 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 aren't 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 don't 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 can't stand sloppy code, and I really don't want to read your code to see what the hell you were really dimming when you say
Visual Basic:
Dim myVariable

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.
Visual Basic:
Dim myInt as Integer = 0

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 I'm 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 don't forget about block coding!
case in point:
Visual Basic:
'In order to comment multiple lines
'I have to put tick's in front of each
'Then when I go to remove them later
'I have to do it line by line
'It sucks!

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 don't have to
do it line by line
*/
[/CS]

I learned how to program in C++, but switched to VB6 for profession because of it's 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, I'm 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 don't care which I use, they're both perfect.
 
Personal feelings and minor language oddities (Option Strict) aside, they're 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 can't. I like VB's 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 I've 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.
 
Robby said:
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. It's in the Tools>>Options dialog. There's a "folder" called Projects and there's 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 shouldn't be able to turn them off through.

Since we're 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:
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 can't 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 VB's 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