C# vs VB
-
I am a C# developer mainly, but I have been looking at some VB code recently. I thought that they were pretty much the same because they compile to similar things, but I'm starting to think that C# is much better. Maybe I'm not giving it a fair chance because I haven't spent much time on it? I was expecting to like it, and had an open mind, but there are some things which I really dislike. The first thing I don't like is the weak typing. I saw these
myVar = "-1" myVar = -1
This really scared me, I found it quite confusing looking at the code. The syntax also doesn't look nice to me, but that's really a personal preference. I'm should there will be lots of opinions, but do you think it's reasonable for me to dislike VB? -
I am a C# developer mainly, but I have been looking at some VB code recently. I thought that they were pretty much the same because they compile to similar things, but I'm starting to think that C# is much better. Maybe I'm not giving it a fair chance because I haven't spent much time on it? I was expecting to like it, and had an open mind, but there are some things which I really dislike. The first thing I don't like is the weak typing. I saw these
myVar = "-1" myVar = -1
This really scared me, I found it quite confusing looking at the code. The syntax also doesn't look nice to me, but that's really a personal preference. I'm should there will be lots of opinions, but do you think it's reasonable for me to dislike VB?Member 4487083 wrote:
do you think it's reasonable for me to dislike VB?
If not, then apparently I'm unreasonable too :) I don't like it at all, but I haven't tried it, and I come from many many years of C/C++ so C# is natural to me.
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
I am a C# developer mainly, but I have been looking at some VB code recently. I thought that they were pretty much the same because they compile to similar things, but I'm starting to think that C# is much better. Maybe I'm not giving it a fair chance because I haven't spent much time on it? I was expecting to like it, and had an open mind, but there are some things which I really dislike. The first thing I don't like is the weak typing. I saw these
myVar = "-1" myVar = -1
This really scared me, I found it quite confusing looking at the code. The syntax also doesn't look nice to me, but that's really a personal preference. I'm should there will be lots of opinions, but do you think it's reasonable for me to dislike VB?Member 4487083 wrote:
do you think it's reasonable for me to dislike VB?
yeah, it is very reasonable. Don't hesitate, go for the real language. BTW: there are some options that are off by default, if you insist on using VB.NET, turn them on (e.g. Option Strict[^]). :)
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
-
Member 4487083 wrote:
do you think it's reasonable for me to dislike VB?
yeah, it is very reasonable. Don't hesitate, go for the real language. BTW: there are some options that are off by default, if you insist on using VB.NET, turn them on (e.g. Option Strict[^]). :)
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
The main option to turn off is when installing Visual Studio. Uncheck the VB.NET box ;P
I know the language. I've read a book. - _Madmatt
-
I am a C# developer mainly, but I have been looking at some VB code recently. I thought that they were pretty much the same because they compile to similar things, but I'm starting to think that C# is much better. Maybe I'm not giving it a fair chance because I haven't spent much time on it? I was expecting to like it, and had an open mind, but there are some things which I really dislike. The first thing I don't like is the weak typing. I saw these
myVar = "-1" myVar = -1
This really scared me, I found it quite confusing looking at the code. The syntax also doesn't look nice to me, but that's really a personal preference. I'm should there will be lots of opinions, but do you think it's reasonable for me to dislike VB?Each language has its own lovers and haters, so does VB. I had been programming in VB for more than 6 years when I changed to C#. But history tells us that VB is the language that has the shortest learning curve. And there are certain features that VB.NET provides out-of-the-box that C# cannot do "neatly", for example, single instance desktop applications.
-
I am a C# developer mainly, but I have been looking at some VB code recently. I thought that they were pretty much the same because they compile to similar things, but I'm starting to think that C# is much better. Maybe I'm not giving it a fair chance because I haven't spent much time on it? I was expecting to like it, and had an open mind, but there are some things which I really dislike. The first thing I don't like is the weak typing. I saw these
myVar = "-1" myVar = -1
This really scared me, I found it quite confusing looking at the code. The syntax also doesn't look nice to me, but that's really a personal preference. I'm should there will be lots of opinions, but do you think it's reasonable for me to dislike VB?Member 4487083 wrote:
weak typing
VB.net is not weak typed. It is strongly typed just like C#. However, the vb.net compiler does not enforce strict type conversions at compile time in the way the C# compiler does. This means that you are able to directly place an Int in a String object and VB will automatically apply the type conversion. It's still strongly typed, the type is still a String, and the int being placed into it will be cast to a String, it's just casts can happen implicitly. You can use the Option Strict[^] setting to change this behaviour and make the compiler act more like the C# one. Either way, the coder is still free to ignore type usage (equally as they could in C# by declaring everything to be an Object). In terms of the language, both are equally capable and equally well supported. The language choice is almost entirely down to personal preference. There is no really significant technical difference between the two. All that said, I personally prefer C# too.
Simon
-
Each language has its own lovers and haters, so does VB. I had been programming in VB for more than 6 years when I changed to C#. But history tells us that VB is the language that has the shortest learning curve. And there are certain features that VB.NET provides out-of-the-box that C# cannot do "neatly", for example, single instance desktop applications.
Shameel wrote:
there are certain features that VB.NET provides out-of-the-box that C# cannot do "neatly", for example, single instance desktop applications.
I don't see what isn't neat about this: http://www.ai.uga.edu/mc/SingleInstance.html[^]. Just because C# doesn't provide tick box for it doesn't mean you can't do it. The choice in language is entirely down to personal preference, there is no significant technical difference.
Simon
-
Member 4487083 wrote:
weak typing
VB.net is not weak typed. It is strongly typed just like C#. However, the vb.net compiler does not enforce strict type conversions at compile time in the way the C# compiler does. This means that you are able to directly place an Int in a String object and VB will automatically apply the type conversion. It's still strongly typed, the type is still a String, and the int being placed into it will be cast to a String, it's just casts can happen implicitly. You can use the Option Strict[^] setting to change this behaviour and make the compiler act more like the C# one. Either way, the coder is still free to ignore type usage (equally as they could in C# by declaring everything to be an Object). In terms of the language, both are equally capable and equally well supported. The language choice is almost entirely down to personal preference. There is no really significant technical difference between the two. All that said, I personally prefer C# too.
Simon
Simon Stevens wrote:
There is no really significant technical difference between the two.
IDE editor support is better in C# IMO but that's a usability rather than a technical difference. The Option Strict off by default was a really lousy decision. I've been bitten by this numerous times when working on VB projects.
Kevin
-
Shameel wrote:
there are certain features that VB.NET provides out-of-the-box that C# cannot do "neatly", for example, single instance desktop applications.
I don't see what isn't neat about this: http://www.ai.uga.edu/mc/SingleInstance.html[^]. Just because C# doesn't provide tick box for it doesn't mean you can't do it. The choice in language is entirely down to personal preference, there is no significant technical difference.
Simon
I you had ever tried one of those solutions, you would realize that all those articles on the internet that teach how to create a single instance desktop application in C# just try to find out if the app is already running and then display a message box that reads "App is already running". I am yet to read any article that teaches how to "neatly" activate the already running instance (without using Microsoft.VisualBasic namespace and AppActivate method). I tried using Win API and P/Invoke but no luck :-(
-
I am a C# developer mainly, but I have been looking at some VB code recently. I thought that they were pretty much the same because they compile to similar things, but I'm starting to think that C# is much better. Maybe I'm not giving it a fair chance because I haven't spent much time on it? I was expecting to like it, and had an open mind, but there are some things which I really dislike. The first thing I don't like is the weak typing. I saw these
myVar = "-1" myVar = -1
This really scared me, I found it quite confusing looking at the code. The syntax also doesn't look nice to me, but that's really a personal preference. I'm should there will be lots of opinions, but do you think it's reasonable for me to dislike VB?Member 4487083 wrote:
I'm should there will be lots of opinions, but do you think it's reasonable for me to dislike VB?
Other people don't like VB.NET, C# or C++, and opt for Python, Ruby or even Pascal[^]. So you're not so sharp on VB. The *cool* news here is that you can team up with a VB.NET programmer, even if he/she isn't too keen on C# - you can both write your .NET classes in your own language :)
I are Troll :suss: