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?
 
> C# programmers get paid more

! I have heard it too... but what makes a C# programmer stronger ???
 
>> ! I have heard it too... but what makes a C# programmer stronger ???

dont think the ppl are bothered bout that though. they want C# fullstop. i have seen guys getting rejected cause they use VB.NET (that too in big concerns). i was shocked. but then again...

i used to have a lot of discussion on this topic with my colleagues and all of them reach the final conclusion of:

Companies want only C#. So code in C#.

and none of them till now have identified the reason as to why companies prefer them which should logically be:

1. technical aspects
2. training costs

I find no difference between the both.

maybe its one of those unsolved mysteries...

Known is handfull, Unknown is worldfull
 
I think some of it has to do with bias and the lack of respect VB received from computer science departments as well as from some ivory towers.

Because you are a programmer with a C- based language it is assumed you are more intelligent, better professionally trained etc. If you were a VB programmer you were thought to be someone who just came off the street, bought Learn VB in 21 Days, and started programming.

VB.NET still has the VB aura surrounding it. Whenever I would bring up VB to maybe a C++ programmer, he/she would start chuckling and shaking his head..."a toy language, a toy language".

Now, we know most of this is just baloney. VB.NET is a very mature, robust programming language that can play with the big boys.

Still I would use C# if I had a preference.
 
>>Still I would use C# if I had a preference.

why? its exactly this aspect that seems to confuse all of us here.

i have to admit that i use VB.NET because that was the first language that i stumbled into while learning ASP.NET. thats it...

Known is handfull, Unknown is worldfull
 
Syntactically I like C# better. In the end it's a matter of preference. For me, it's more compact. For example, just declaring and initializing a variable:

Code:
C# 
string foo = "foo fighter";

Code:
VB.NET
Dim foo As String = "foo fighter"

for something like creating a derived class
Code:
C#
public class foobar:foo
{
}
Code:
vb.net
Public Class foobar
    Inherits foo

End Class

For statements are much more compact in C#. I don't have to declare the incrementing variable (i) outside of the for statement.
Code:
for(int i=0;i<100,i++)
{

}

Also, I like the fact that I can build the comments in my code in C# into a viewable xml-based web page by starting the comment with three slashes ///.

This is just a short list and by no means the most salient.

And let's say down the road I want to learn PHP. Knowing C# lowers the learning curve considerably.

 
> Learn VB in 21 Days, and started programming
! What is so difficult with C# ? I also started with VB, I liked it and went on learning much more. I could have done the same if i started C#.


> incrementing variable (i) outside of the for statement ?

For i As Integer = 0 To 99 Step 1
' code
End For

It is ok with VB too.


> build the comments in my code
! What is the problem doing this with VB ?
 
for something like creating a derived class

Code:
C#
public class foobar:foo
{
}

Code:
vb.net
Public Class foobar
    Inherits foo

End Class

Code:
JAVA
public class foobar extends foo 
{
}

So not really the same.



Christiaan Baes
Belgium

"My new site" - Me
 
I have seen this thread around for awhile now so I would like to comment.

You guys proablly have much more programming experience then me so go easy on my comments.

I wanted to learn c# as I went from vb6 to .net

project deadlines got in the way of that. so, I stuck with what I know. I think "C" in general gets much more respect then VB. C goes back to C++, VB goes back to VBA. I remember hearing comments like, "oh it's just a VB application" why wasn't that done in C". comments like that come from people who have no idea what the H**L there talking about. I will again look at c# and see if I can learn more of it to use in my apps. I think with the jump to .net the question is, does it really matter what you use? J# doesn't seem to have taken off like MS thought it would(atleast i don't see it that way) if so, maybe this thread would be "Should I use J# or VB"

I think it's what you prefer. But, I also think knowing both of them would be a plus for you.



 
As I said earlier, the differences are a matter of preference and also syntactical.

I've created the exact same projects in both languages and have not noticed a difference in performance.

It depends on what you're doing. I've heard that some I/O operations are faster with C#. If you are interfacing with Microsoft Office, VB.NET is probably better.

I think we can put this to bed by saying that a good program is more about the programmer than the actual language.

J# is just like J++ from Visual Studio 6.0. It was supposed to bring on board former Java developers to use Microsoft developer tools. I think you might find five jobs on DICE for it.

The computer world can be a bit faddish. Remember when Fox Pro was all the rage, or DBase? Those two have been relegated to COBOL status.
 
IT4EVR said:
For statements are much more compact in C#. I don't have to declare the incrementing variable (i) outside of the for statement.
You don't have to declare the variable outside the loop in VB.NET:
Code:
For i as Integer = 0 to 100

Next


____________________________________________________________

Need help finding an answer?

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

 
Thanks for the clarification. I wasn't in any way trying to knock the VB.NET language.

It's just like if someone was interested in learning languages. He/she might prefer the sound of Italian over Spanish, etc.
 
I met a Microsoft guy the other day who said that both C# and VB.NET are only scripting languages, and that *real* programmers use IL directly.
:)

So it all depends on your perspective.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
> C# programmers get paid more

! I have heard it too... but what makes a C# programmer stronger ???

I don't think the reason is so much of a difference between C# and VB.NET as it is the typical background of the developers adopting the language.

Really, .NET languages are all very similar in capability, but generally speaking, C# developers are more likely to come from a C++/Java background while VB.NET developers may have coded in VB6 and VBA, and there is a huge difference between object oriented languages and more procedural/scripted languages like VBA. With old VB, I think there was a lot less emphasis on elegant architecture and a lot more emphasis on getting the job done.

Thus, with C#, I think you have more people coming from a high-paid architect/engineering background and with VB.NET you have more people who came from, say, a place were paid relatively little to make macros for Microsoft Office applications; old VB developers are willing to settle for less because they're used to getting paid less.

I think I read an article where someone discussed the phenomenon. He said something about "VB.NET adopting the stigma of being a toy language, deservedly or not".



 
You don't have to declare the variable outside the loop in VB.NET:

ca8msm, you did not see my post lol. I guess i should have written the code between code-tags.

__________________

BoulderBum said:
VB.NET developers may have coded in VB6 and VBA

"may" exactly. The point is that VB.NET is OOP too. So things like vb6 or vba should be unknown words. If a VB.NET developer wants to program with C#... there should not be any problem at all; just 1 or 2 hours to learn the syntax.

__________________

BoulderBum said:
stigma of being a toy language

Yes, the 'basic' term means Beginner's All ... bla bla bla i dont remember the next.

__________________
Q: If you can do 1000 things with VB.NET, how many can you do with C# ?

Waiting for your answers...
 
Awesome discussion!

In a nutshell...

Code:
If languages.known = 1 Then
	CareerType.Length = limited

ElseIf languages.known > 1 Then
	CareerType.Length = unlimited

	for i as Languages = 1 to (SELECT As Many FROM Brain inner join humor on laugh = now)
		Career.PayScale = i + Pay.Increase
	next

ElseIf languages.changes.ToNew("Yet To Be Developed") 
	CareerType.Uncertain = true

Else
	CType(Career.Path, Plumber)

End If


---
Q : If you can do 1000 things with VB.NET, how many can you do with C# ?

A : 1000


Id say nothing cant be done in any language, just a matter of research time.
 
The point is that VB.NET is OOP too.

My point was that I think the pay difference is more about the developers' background than it is about the .NET languages, because you're right: they are all but identical in capability.

That said, if you're looking for something C# can do that VB.NET can't, you can consider the XML comments built into the language (no plug-in required).

Really the differences are trivial and were minimized with the advent of VB.NET 2005.

More:
 
adamroof,
I got compiler errors:

1. 'CType(Career.Path, Plumber)' : Has to be assigned
2. 'SELECT As Many FROM Brain inner join humor on laugh = now' : Connection not open
3. 'Pay.Increase' : You must not have added a reference or imports statement.

L O L
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top