Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why C# over VB

Status
Not open for further replies.

adamroof

Programmer
Nov 5, 2003
1,107
US
Ive just finished a new site and decided to use C# solely so i could learn it extensively, and i must say, its pretty nice. So im just posting this so those that are starting out may have some input on what language to use.

These are my opinions, please feel free to add to, take from, and tear apart.

VB
1. easier to read logic (if then else end if)

2. dont have to put a semicolon on each line end

3.


C#
1. easier to write logic (if (){} else {})

2. similar to javascript, which is almost required to implement a decent ASP.net site, so a broader understanding of code options

3. easier variable declarations and consumption

4. easier line continuation for readability

5.



What do you all think?
 
I think it makes no difference at all - whichever language you prefer and feel most comfortable with is the one you should use.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
agreed

both have same performance, both are well used and supported.
 
Magic keyword "MSIL". Use whatever, whether VB, C# or J# to develop. Perhaps you could help a little on what you mean on VB 3 and C# 5. Heh.
In C# by 3 and 4... what is the problem using the VB ?
 
In C# by 3 and 4... what is the problem using the VB ?
Actually, I was wondering what was meant by #1 as well. I don't see any more simplicity in writing an If Else statement using C# over VB.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
both do the jobs intended, both make sense to me,
My point is not to knock either way, just identify a couple of differences.

My words "easier" applies only to me within this thread!

#1
----
c# becuase of the similarities in javascript, and with AJAX prevelance and client side "speed" (avoiding postbacks) i liked going between my cs file and js file better than my vb file and js file


#3
----
c# - DataSet ds = new DataSet();
vb - Dim ds As New DataSet()

-depends on taste, which way you like or consider "easier"


#4
----
c# - + "text"
+ "more"
+ "again";

vb = & "text" & _
"more" & _
"again"

 
c# is less forgiving of sloppiness. It is harder to read giant conditional statements and forces me to use shortable, easier to test and maintain functions.



Brian Begy
BugSentry - Automatic error reporting for .NET and COM
 
true, thats what "scared" me away from c# for a while, i stand by vb for readability! yet with decent intellisense and outlining and that cool "Format Document" option, im getting used to it a little.

any die hard c# guys have any additional info?

(ive seen a few posts stating "c#, always have, always will")
 
I use both but to me VB just seems so much easier to write and read, it "makes sense" when you look at it, with C# I seem to have to look much harder at the code to see what it's doing, it's less verbose but I have to spend more time on it. I would love to use VBScript on the client side too but alas we all know that's not going to happen, Javascript is bad enough to deal with so I'm using more and more VB on the server side. Also VB has all those great string functions built in.

If more than 1 goose are geese, why aren't more than 1 moose meese??
[censored][censored][censored]
 
It's been shown that the MSIL for VB.NET is a bit different than MSIL for C#. It's a myth that there is no difference at all, it all maps out to MSIL anyway.

The MSIL will often have more lines of code for VB.NET than C#. It has been demonstrated that for some things, C# is faster.

Overall there isn't much of a difference in performance.

However, think of this. Why is Microsoft prefers using C# to develop it's own software?

 
Another advantage of C# is that it's a C based language and uses a syntax familiar to Java, etc. Not many programmers use only one language in their career, or shouldn't. One day you might have to do some Java or PHP and knowing C# will get you there much quicker.

This is the link regarding the difference in the MSIL for VB.NET and C#.

 
VB.NET is some steps ahead. Have a search on late binding, object type... e t c

Regards
(I hate <a little> C 'based' languages)
 
really glad i posted this! i never heard of MSIL before, never realized there are building blocks behind the building blocks of code!

but you know, since i now "know" vb and c# i would then recommend learning both and using both (not in same project). I guess a "good" programmer would do that anyway, never knowing what project lies next.

the main difference of the two in discussion would be solely semantics and syntax, not too much to grasp if you know one or the other.

is that what they teach all those programmers with degrees in computer science?
 
I think a great way to learn each language better is to create a small project in one language and completely translate it in the other language.

If you do this especially for an OOP type of project, you'd be surprised how you learn more.

 
The main difference: C# programmers get paid more.

There are a few bells and whistles with one language vs. another ("using" statements, COM templates, "My" keyword, etc.), but I think that point is the strongest one.
 
i agree with boulder.

i have noticed that many companies which hire .NET professionals require C# as their programming language.

who though? i never understand!

one reason maybe that it resembles java and companies find it easy to convert guys from java to c#...

Known is handfull, Unknown is worldfull
 
It resembles Java just enough to make transition just that bit more annoying. You think you know the syntax but you don't.

Christiaan Baes
Belgium

"My new site" - Me
 
>>It resembles Java just enough to make transition just that bit more annoying. You think you know the syntax but you don't.

that bugging huh???

Known is handfull, Unknown is worldfull
 
I watched a video tour of a Microsoft building where they were creating software. Hosted by Don Box, the COM genius who was instrumental in creating SOAP, one by one he went to each software design engineer's office. What were 90% of them programming in? C#

The FCL is written in C#, the Web Data Administrator is written in C#, etc etc etc.

Just out of curiosity, does Vb.net have generics? That's considered one of the strongest aspects of the C# 2005 version.

Not only is the pay better for C# programmers, but there are more jobs on the market for C# programmers.

I come from the VB world, but after playing with C#, there is no way I would want to go back to VB.NET--unless the job required it. But there is no excuse for not learning both languages well. And while you're at it, why not Managed C++?

The languages are so similar that you will notice very little difference between the VB.NET or C# for ASP.NET Microsoft Exam.

Of course these are just my opinions.
 
Generics is a part of the framework. And it was introduced in Java (1.5) at about the same time so I wonder who got the idea first.

Christiaan Baes
Belgium

"My new site" - Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top