473,383 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

vb.net or C#?

Dan
Hi,

i develop webapplications with asp.net and vb.net. Is there any good reason
why i should switch to (and learning) C#?

Thanks for the pro's and contra's.
Dan
Aug 17 '08 #1
37 1706
The main reason is that you'll be able to do jobs in both c# and vb.net.
Your understanding of the framework will already stand you in a good stead
to learn it.

This is old, but useful all the same.
http://blogs.msdn.com/csharpfaq/arch.../11/87816.aspx

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog

"Dan" <nm@zszsz.xvwrote in message
news:O0**************@TK2MSFTNGP06.phx.gbl...
Hi,

i develop webapplications with asp.net and vb.net. Is there any good
reason why i should switch to (and learning) C#?

Thanks for the pro's and contra's.
Dan

Aug 17 '08 #2
"Dan" <nm@zszsz.xvwrote in message
news:O0**************@TK2MSFTNGP06.phx.gbl...
I develop webapplications with ASP.NET and VB.NET. Is there any good
reason why I should switch to (and learn) C#?
Technically speaking, no. C# supports unsafe code aka pointers, but that's
about the only difference...

Commercially speaking, learning C# will (in theory anyway) make you twice as
marketable...

Since you work with ASP.NET, you will almost certainly have plenty of
experience with JavaScript, so you will not find the C# syntax too difficult
to grasp..
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 17 '08 #3
Dan
Thanks, i start right now with C# ...

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netschreef in bericht
news:Ol**************@TK2MSFTNGP05.phx.gbl...
"Dan" <nm@zszsz.xvwrote in message
news:O0**************@TK2MSFTNGP06.phx.gbl...
>I develop webapplications with ASP.NET and VB.NET. Is there any good
reason why I should switch to (and learn) C#?

Technically speaking, no. C# supports unsafe code aka pointers, but that's
about the only difference...

Commercially speaking, learning C# will (in theory anyway) make you twice
as marketable...

Since you work with ASP.NET, you will almost certainly have plenty of
experience with JavaScript, so you will not find the C# syntax too
difficult to grasp..
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 17 '08 #4
On 17 Aug, 21:17, "Dan" <n...@zszsz.xvwrote:
Hi,

i develop webapplications with asp.net and vb.net. Is there any good reason
why i should switch to (and learning) C#?

Thanks for the pro's and contra's.
Dan
Hi Dan

I started working in VB.NET for web apps but have since changed over
to C#

I prefer it but have never been able to pin down the reason(s). It
might be the use of symbols such as { } for statement blocks rather
than key words like if, end if etc Without the code assistant this
would make a lot of difference, but as it is the VS code editor saves
a lot of typing.

One thing you may find strange at first are the different rules for
assignment compatibility. VB allows strings and numbers to be used
almost interchangeably but C# is more fussy and requires explicit
conversion. Use the Parse() function for strings to numbers and dates.
Also remember that Session[] and DataRow/DataRowView indexes return
objects that require type casting in C#
You will also find that list elements have values that are strings and
unlike VB will cannot be aigned to number variables without
conversion.

Good luck
Aug 17 '08 #5
For the most part, they are exactly the same language but with slightly
different syntax. With few exceptions, it comes down to your taste in syntax
and what language potential employers are deciding to use.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
"Dan" <nm@zszsz.xvwrote in message
news:O0**************@TK2MSFTNGP06.phx.gbl...
Hi,

i develop webapplications with asp.net and vb.net. Is there any good
reason why i should switch to (and learning) C#?

Thanks for the pro's and contra's.
Dan
Aug 17 '08 #6
If

Option Strict On
Option Explicit On

is set in vb.net files (or there are project level settings)

Then vb.net works almost like c#.

But there is no way to "turn it off" in C#, which I prefer.

"Stan" <go********@philhall.netwrote in message
news:84**********************************@d1g2000h sg.googlegroups.com...
On 17 Aug, 21:17, "Dan" <n...@zszsz.xvwrote:
>Hi,

i develop webapplications with asp.net and vb.net. Is there any good
reason
why i should switch to (and learning) C#?

Thanks for the pro's and contra's.
Dan

Hi Dan

I started working in VB.NET for web apps but have since changed over
to C#

I prefer it but have never been able to pin down the reason(s). It
might be the use of symbols such as { } for statement blocks rather
than key words like if, end if etc Without the code assistant this
would make a lot of difference, but as it is the VS code editor saves
a lot of typing.

One thing you may find strange at first are the different rules for
assignment compatibility. VB allows strings and numbers to be used
almost interchangeably but C# is more fussy and requires explicit
conversion. Use the Parse() function for strings to numbers and dates.
Also remember that Session[] and DataRow/DataRowView indexes return
objects that require type casting in C#
You will also find that list elements have values that are strings and
unlike VB will cannot be aigned to number variables without
conversion.

Good luck

Aug 17 '08 #7
If you started with VB.NET, probably not. If you started with VB and moved
to VB.NET, you are probably using a lot of training wheels. The easiest way
to tell is whether or not you are using the Microsoft.VisualBasic
namespaces, esp. .Compatibility. In this case, learning C# makes you more
likely to learn the Framework and get rid of the training wheels.

As far as other reasons. I find there are more C# jobs than VB.NET. If this
is not true in your area, then you need not worry, other than the suggestion
above.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
"Dan" <nm@zszsz.xvwrote in message
news:O0**************@TK2MSFTNGP06.phx.gbl...
Hi,

i develop webapplications with asp.net and vb.net. Is there any good
reason why i should switch to (and learning) C#?

Thanks for the pro's and contra's.
Dan
Aug 17 '08 #8
I would disagree that they are "exactly the same language but with slightly
different syntax". Language wise, there are loads of difference. But, if you
are using the Framework properly, they are fairly identical. One uses [],
the other () and you have to add semi-colons. :-)

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
"Jonathan Wood" <jw***@softcircuits.comwrote in message
news:OE**************@TK2MSFTNGP05.phx.gbl...
For the most part, they are exactly the same language but with slightly
different syntax. With few exceptions, it comes down to your taste in
syntax and what language potential employers are deciding to use.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
"Dan" <nm@zszsz.xvwrote in message
news:O0**************@TK2MSFTNGP06.phx.gbl...
>Hi,

i develop webapplications with asp.net and vb.net. Is there any good
reason why i should switch to (and learning) C#?

Thanks for the pro's and contra's.
Dan
Aug 17 '08 #9
One thing you may find strange at first are the different rules for
assignment compatibility. VB allows strings and numbers to be used
almost interchangeably but C# is more fussy and requires explicit
conversion.
The first thing a VB .NET developer should do is turn on Option Strict for
all their projects. Once that is done, VB .NET is a type-safe language,
just as C# is and the situation you described above will not be allowed.

-Scott
Aug 17 '08 #10
"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMwrote in
message news:uh**************@TK2MSFTNGP06.phx.gbl...

[top-posting corrected]
>>I develop webapplications with ASP.NET and VB.NET. Is there any good
reason why I should switch to (and learn) C#?

For the most part, they are exactly the same language but with slightly
different syntax.

I would disagree that they are "exactly the same language but with
slightly different syntax".
So would I.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 17 '08 #11
Cowboy,
>I would disagree that they are "exactly the same language but with slightly
different syntax". Language wise, there are loads of difference. But, if
you are using the Framework properly, they are fairly identical. One uses
[], the other () and you have to add semi-colons. :-)
Heh, well I did say "for the most part." But, really, I find when I'm
reading books that show code samples in both VB.NET and C#, I find almost no
reason to look at the sample that uses the code I happen to be using.
Primarily for the reason you suggested: most of the language consists of
framework calls. Just a different syntax.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
>
--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
"Jonathan Wood" <jw***@softcircuits.comwrote in message
news:OE**************@TK2MSFTNGP05.phx.gbl...
>For the most part, they are exactly the same language but with slightly
different syntax. With few exceptions, it comes down to your taste in
syntax and what language potential employers are deciding to use.

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
"Dan" <nm@zszsz.xvwrote in message
news:O0**************@TK2MSFTNGP06.phx.gbl...
>>Hi,

i develop webapplications with asp.net and vb.net. Is there any good
reason why i should switch to (and learning) C#?

Thanks for the pro's and contra's.
Dan
Aug 17 '08 #12
Dan wrote:
Hi,

i develop webapplications with asp.net and vb.net. Is there any good
reason why i should switch to (and learning) C#?

Thanks for the pro's and contra's.
Dan
In addition to what is already said, I like the "My" namespace a lot in
VB.NET.
It is missing in C#.

--

Riki
Aug 18 '08 #13
Dan wrote:
Hi,

i develop webapplications with asp.net and vb.net. Is there any good reason
why i should switch to (and learning) C#?

Thanks for the pro's and contra's.
Dan

Regardless if you switch language or not, you will get a better
understanding of programming in general by learning C# too.

C# and VB.NET compile into pretty much the same IL code, so learning how
C# works will also make you understand better what your VB.NET code does.

--
Göran Andersson
_____
http://www.guffa.com
Aug 18 '08 #14

"Dan" <nm@zszsz.xvwrote
i develop webapplications with asp.net and vb.net. Is there any good
reason why i should switch to (and learning) C#?
No. But let me give you my opinion.

For making applications, it should not matter that much, it's not that one
is that much better then the other.

For job opportunities, I think you should do some C#.

Then another thing is, how much trouble would you have writing in another
language? The past two years I've used C++, Delphi, Java, VB.NET, C#,
ASP.NET, JSP and Javascript in different projects. If I work in one language
for two weeks I am used to it. Even though I have more experience in C++ for
example, now I am programming in Delphi, and if I now have to write C++ code
I put 'then' afther my if statements. Just like on holiday, after speaking
Spanish for two weeks, I forget my German en English, while I am Dutch.

Hence the writing EndIf instead of }, that's not really the main problem in
writing ASP.NET programs, that what I think. One could change from VB to C#
in less then a month. Learning the framework possibilities would cost you a
year at least.
Aug 18 '08 #15

"Göran Andersson" <gu***@guffa.comwrote
C# and VB.NET compile into pretty much the same IL code, so learning how
C# works will also make you understand better what your VB.NET code does.
I don't agree. It's mostly different syntax words for the same. So if you
want to understand syntax, and OOP for example, study OOP in a language you
already know is better then learning different syntax details of another
language. You could better study how compilers work, how OOP works,
independant of the exact language. If you understand that, it's relative
less difficult to work in another language.
Aug 18 '08 #16

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote
>>For the most part, they are exactly the same language but with slightly
different syntax.
>I would disagree that they are "exactly the same language but with
slightly different syntax".
So would I.
But I would not. :-)

Nowadays with an IDE that already gives you a warning something is not
according to the syntax of a certain language before you press compile, the
reds curly lines, it's quite easy.
Aug 18 '08 #17
"Marc" <m.********@removethischello.nlwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>>>For the most part, they are exactly the same language but with slightly
different syntax.

I would disagree that they are "exactly the same language but with
slightly different syntax".

So would I.

But I would not. :-)

Nowadays with an IDE that already gives you a warning something is not
according to the syntax of a certain language before you press compile,
the reds curly lines, it's quite easy.

Please explain how C# and VB.NET are "for the most part exactly the same
language but with slightly different syntax"...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 18 '08 #18

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote
Please explain how C# and VB.NET are "for the most part exactly the same
language but with slightly different syntax"...
Both are object oriented computer languages compiling to the same
intermediate language and working on the same framework libs. Anyway it
would also say that for Java and C#. Here the syntax is even more simular,
but then you use another framework. You do not have to know all the details
of a language to write code in it. Ok, it makes you a bit faster if you do,
that is true. You paste and copy code less. You use codesnippets less.

The IDE, the framework, the libs, the domain you write code for, client
server programming in general, that's far more important then the language
as such.
Aug 18 '08 #19
Marc wrote:
"Göran Andersson" <gu***@guffa.comwrote
>C# and VB.NET compile into pretty much the same IL code, so learning how
C# works will also make you understand better what your VB.NET code does.

I don't agree. It's mostly different syntax words for the same. So if you
want to understand syntax, and OOP for example, study OOP in a language you
already know is better then learning different syntax details of another
language.
Have you considered the fact that many elements in the VB syntax is
intended to hide what's actually going on? It doesn't matter how long
you stare at the code, you still can't see what's not there. ;)
You could better study how compilers work, how OOP works,
independant of the exact language. If you understand that, it's relative
less difficult to work in another language.
Agreed, you can gain the same knowledge by studying these aspecs
independently of any language. However, it's harder to find that kind of
material, as most examples are written to actually be used in a specific
language.

--
Göran Andersson
_____
http://www.guffa.com
Aug 18 '08 #20

"Göran Andersson" <gu***@guffa.comwrote
Have you considered the fact that many elements in the VB syntax is
intended to hide what's actually going on?
Mmmm, yes that's true. In that case C# is better.
Aug 18 '08 #21


"Göran Andersson" <gu***@guffa.comwrote in message
news:un**************@TK2MSFTNGP04.phx.gbl...
>
Have you considered the fact that many elements in the VB syntax is
intended to hide what's actually going on?
Isn't that the purpose of a higher level language: to abstract the details
away ? Or do you consider Using blocks or iterators or anonymous delegates
or captures all bad ?

Aug 18 '08 #22

"Marc" <m.********@removethischello.nlwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>
Nowadays with an IDE that already gives you a warning something is not
according to the syntax of a certain language before you press compile,
the reds curly lines, it's quite easy.
Still does not make things the same language. While the IDE may warn you
that things are awry, it will not tell you how to correct your code. If all
that is wrong is curly braces or semi-colons, you are tracking. But there
are other languages differences that do matter.

A quick example:

builder.Append("\r\n");

builder.Append(vbCrLf)

Now, you don't have to use vbCrLf, of course, but most vb devs would, as it
is familiar. How about this:

string connString = "";
SqlConnection conn = new SqlConnection(connString);

Dim connString as String = ""
Dim conn As new SqlConnection(connString)

Functionally equivalent, but knowing the syntax is wrong (backwards?) does
not help you write it. Or how about this:

using(SqlConnection conn = new SqlConnection(connString))
{
conn.Open();
//etc.
}

Dim conn As New SqlConnection(connString)

Try
conn.Open()
Finally
conn.Dispose()
End Try

With no using in .NET 2.0, you are forced to use a Try ... Finally to
accomplish the same thing. No amount of red squigglies will give you the
knowledge to do that.

It gets even more difficult to translate when you start using Generics, as
C# using a much simpler syntax. I could also go into a list of differences
in string handling, LINQ, etc.

As I stated, I agree that they are functionally equivalent, at least
overall, but they are not the same language sans curly braces.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************

Aug 18 '08 #23

"Jonathan Wood" <jw***@softcircuits.comwrote in message
news:ee**************@TK2MSFTNGP03.phx.gbl...
>
Heh, well I did say "for the most part." But, really, I find when I'm
reading books that show code samples in both VB.NET and C#, I find almost
no reason to look at the sample that uses the code I happen to be using.
Primarily for the reason you suggested: most of the language consists of
framework calls. Just a different syntax.
As long as the developer uses the Framework, it is largely true. A lot of VB
developers use the training wheels (VB Compatibility namespace), so all bets
are off. I listed some other differences in response to Marc. ;->

When I am forced to use VB, I often find it prudent to code in C#, compile
and then use Reflector to find the equivalent VB syntax. :-)

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************

Aug 18 '08 #24

"Marc" <m.********@removethischello.nlwrote in message
news:OO**************@TK2MSFTNGP06.phx.gbl...
>
"Göran Andersson" <gu***@guffa.comwrote
>C# and VB.NET compile into pretty much the same IL code, so learning how
C# works will also make you understand better what your VB.NET code does.

I don't agree. It's mostly different syntax words for the same. So if you
want to understand syntax, and OOP for example, study OOP in a language
you already know is better then learning different syntax details of
another language. You could better study how compilers work, how OOP
works, independant of the exact language. If you understand that, it's
relative less difficult to work in another language.
You are working with an ideal that is not always present in the world.
Perhaps more now as newer VB devs are coming into the world with no previous
legacy VB experience. But, I found that many, if not most, VBers in the
early .NET days were legacy VBers that switched to .NET. I found tons of
ASP.NET, written like ASP. Things like:

myObject = Object.CreateInstance("")

Yuck. The same was true for the VB syntax. Legacy VB in a .NET app.

I was an ASP/VB COM developer. I switched to C# to make sure I was learning
..NET and not merely trying to code VB into VB.NET. I think this is what
Göran is aiming at. And, if so, I agree with him.

Underneath the hood, it is all IL. And, if someone is truly following OO
practices and using the framework, there are tons of similarities and one
can easily switch, for the most part, from language to language.

But the fact that they compile to the same byte code (have the smae lower
level language) does not mean the higher level language is the same.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************

Aug 18 '08 #25

"Bill McCarthy" <Bi**@localhost.comwrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl...
>
"Göran Andersson" <gu***@guffa.comwrote in message
news:un**************@TK2MSFTNGP04.phx.gbl...
>>
Have you considered the fact that many elements in the VB syntax is
intended to hide what's actually going on?

Isn't that the purpose of a higher level language: to abstract the details
away ?
Abstract == good;
Hiding == bad;

Please note the semi-colons.

I am actually just toying with you Bill, because I know you are such a good
sport. ;-)

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************

Aug 18 '08 #26
"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMwrote in
message news:OM**************@TK2MSFTNGP06.phx.gbl...
With no using in .NET 2.0, you are forced to use a Try ... Finally to
accomplish the same thing. No amount of red squigglies will give you the
knowledge to do that.
http://msdn.microsoft.com/en-us/libr...hh(VS.80).aspx
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 18 '08 #27

"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMwrote in
message news:uc**************@TK2MSFTNGP02.phx.gbl...
>
"Bill McCarthy" <Bi**@localhost.comwrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl...
>>
"Göran Andersson" <gu***@guffa.comwrote in message
news:un**************@TK2MSFTNGP04.phx.gbl...
>>>
Have you considered the fact that many elements in the VB syntax is
intended to hide what's actually going on?

Isn't that the purpose of a higher level language: to abstract the
details away ?

Abstract == good;
Hiding == bad;

Please note the semi-colons.

I am actually just toying with you Bill, because I know you are such a
good sport. ;-)
<g Yeh where's my cricket bat when I need it ? ;)

I actually can't think of anything VB hides from you. C# on the other hand
has stuff like :

class Foo : IBar
{
void Baz() {}

void Boo() {}
}

How can I be absolutely sure IBar is an interface other than reliance on a
non enforced naming pattern you hope people follow ? How can I tell whether
Baz or Boo are defiend by IBar or not ?

;)







Aug 18 '08 #28

"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMwrote
But the fact that they compile to the same byte code (have the smae lower
level language) does not mean the higher level language is the same.
Ah ok, but that's then just because of VB is such a strange language? I have
not done that much in VB, I found it easy to do a little VB programming with
my C++/Java/C# experience. But some things were a bit like 'we don't show
you what really happens since you're to stupid to understand anyway', as far
as I remember. (I only worked a few weeks with it.)

Ok let me refrase then, you can study Delphi, Java, C++ or C# to know how
for example OOP works, it won't matter which of the four advanced languages
you would use.
Aug 18 '08 #29
Mark,
Please explain how C# and VB.NET are "for the most part exactly the same
language but with slightly different syntax"...
Sorry, but in my view, it's sort of like you occasionally getting hung up
about whether or not someone top posted over what they were actually
writing. The languages are not identical, obviously, but if you look at the
big picture, they really are the same for the most part.

C# and VB.NET use *EXACTLY* the same runtime library, which is running on
the same rich operating system API. For managed code, this means almost
everything. Gone are the days when you write directly to video RAM. Writing
code in a .NET language consists mostly of writing for the frameworks.

Moreover, both compile to the same IL code, which means they are more
similiar than just code that only needs to produce the same machine code.

Yes, one uses semicolons, etc. But that's all just syntax. The big picture
is the frameworks and, with very few exceptions, anyone who understands
VB.NET or C# will be able to understand code written using the other
language.

Jonathan

Aug 18 '08 #30
Cowboy,
builder.Append("\r\n");

builder.Append(vbCrLf)
These two lines are incredibly similar and produce the exact same result. As
I stated previously, the difference is syntax.
string connString = "";
SqlConnection conn = new SqlConnection(connString);

Dim connString as String = ""
Dim conn As new SqlConnection(connString)
And now C# allows var conn = new SqlConnection(connString). You're
discussing syntax as though it makes these two snippets of code different in
some substantial way. I don't get that. They are accomplishing exactly the
same thing, with the same library, to the same ends. The difference, again,
is syntax.
using(SqlConnection conn = new SqlConnection(connString))
{
conn.Open();
//etc.
}

Dim conn As New SqlConnection(connString)

Try
conn.Open()
Finally
conn.Dispose()
End Try
There are some contructs that could be discribed as more than just syntax.
That's why I said "for the most part" in my original comments on this. But I
still view the above items as exactly the same thing. using provides another
way to do the exact same thing this VB code does but with a different
syntax.

Sure, you can look at the minutia of curly braces and semicolons, and that's
fine if you think that matters. But I've worked extensively with different
languages, and had good reasons to pick one over the other. I used assembler
when my code needs to be as tight as possible. I used VB6 when I need to put
together a Windows application quickly. But I don't have any good reason to
pick C# over VB.NET other than my own personal tastes and issues related to
how many of my potential customers might want to use a particular language.

I mean, do you think I'm going to choose one language over the other because
one lets me use using instead of try/catch? I don't understand why that even
matters.

Jonathan

Aug 18 '08 #31
Cowboy,
As long as the developer uses the Framework, it is largely true. A lot of
VB developers use the training wheels (VB Compatibility namespace), so all
bets are off. I listed some other differences in response to Marc. ;->
BTW, I haven't tried this, but is there any reason why you couldn't use the
VB Compatibility namespace from C#?

Jonathan

Aug 18 '08 #32

"Jonathan Wood" <jw***@softcircuits.comwrote in message
news:eR****************@TK2MSFTNGP06.phx.gbl...
Mark,
>Please explain how C# and VB.NET are "for the most part exactly the same
language but with slightly different syntax"...

Sorry, but in my view, it's sort of like you occasionally getting hung up
about whether or not someone top posted over what they were actually
writing. The languages are not identical, obviously, but if you look at
the big picture, they really are the same for the most part.

C# and VB.NET use *EXACTLY* the same runtime library, which is running on
the same rich operating system API. For managed code, this means almost
everything. Gone are the days when you write directly to video RAM.
Writing code in a .NET language consists mostly of writing for the
frameworks.

Moreover, both compile to the same IL code, which means they are more
similiar than just code that only needs to produce the same machine code.

Yes, one uses semicolons, etc. But that's all just syntax. The big picture
is the frameworks and, with very few exceptions, anyone who understands
VB.NET or C# will be able to understand code written using the other
language.
Yep. VB has some features C# doesn't when it comes to working with COM
interop, and also with XML. C# on the other hand has unsafe code and
multi-statement lambdas.

Aug 18 '08 #33

"Jonathan Wood" <jw***@softcircuits.comwrote in message
news:u3**************@TK2MSFTNGP06.phx.gbl...
>
I mean, do you think I'm going to choose one language over the other
because one lets me use using instead of try/catch? I don't understand why
that even matters.
For the record VB does have Using blocks, has since 2005 ;) The only time
there is a significant functional difference between the two is unsafe code
and COM interop. For example, this is real code I saw someone doing in c# :

if(xlApp.Dialogs[Excel.XlBuiltInDialog.xlDialogOpen].Show(sTextName,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing)
In VB, that code is:
If xlApp.Dialogs(Excel.XlBuiltInDialog.xlDialogOpen). Show(sTextName) Then
And inversly I bet we could dig up examples of unsafe code in C#, and lots
of Marshal.Readxxx and Write calls in VB.

Aug 18 '08 #34
Bill,
For the record VB does have Using blocks, has since 2005 ;) The only
time there is a significant functional difference between the two is
unsafe code and COM interop.
Right. I haven't messed with anything like that using a .NET language, but
my main point is that when you are writing to the frameworks using managed
code, I really don't think it matters which language you choose. If one
language allows more unsafe and COM interop stuff, then that could
potentially be a reason to pick one over the other. That said, however, I
think things like COM interop primarily bridge the gap with older
technologies, and while I don't think that many people are doing stuff like
that now from .NET, I suspect far less will be doing it in the future.

Jonathan

Aug 18 '08 #35

"Jonathan Wood" <jw***@softcircuits.comwrote in message
news:Oy**************@TK2MSFTNGP03.phx.gbl...
Bill,
>For the record VB does have Using blocks, has since 2005 ;) The only
time there is a significant functional difference between the two is
unsafe code and COM interop.

Right. I haven't messed with anything like that using a .NET language, but
my main point is that when you are writing to the frameworks using managed
code, I really don't think it matters which language you choose. If one
language allows more unsafe and COM interop stuff, then that could
potentially be a reason to pick one over the other. That said, however, I
think things like COM interop primarily bridge the gap with older
technologies, and while I don't think that many people are doing stuff
like that now from .NET, I suspect far less will be doing it in the
future.
Yep. I think COM interop will be around for a long time, at least on the
desktop computer, but as far as ASP.NET goes, I'd try to avoid it and also
avoid unsafe code as well. If I was doing a lot of XML, I'd definitely
favour VB, and if I was doing a lot of iterators such as writing a LINQ
provider, I'd probably favour C#. Other than that, the differences are
mainly a matter of taste. One might prefer one of the other, but there
aren't going to be any significant technical hurdles or limitations in one
against the other.

Aug 18 '08 #36
"Bill McCarthy" <Bi**@localhost.comwrote in message
news:eF**************@TK2MSFTNGP04.phx.gbl...
>
"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMwrote in
message news:uc**************@TK2MSFTNGP02.phx.gbl...

"Bill McCarthy" <Bi**@localhost.comwrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl...
>
"Göran Andersson" <gu***@guffa.comwrote in message
news:un**************@TK2MSFTNGP04.phx.gbl...

Have you considered the fact that many elements in the VB syntax is
intended to hide what's actually going on?

Isn't that the purpose of a higher level language: to abstract the
details away ?
Abstract == good;
Hiding == bad;

Please note the semi-colons.

I am actually just toying with you Bill, because I know you are such a
good sport. ;-)

<g Yeh where's my cricket bat when I need it ? ;)

I actually can't think of anything VB hides from you. C# on the other
hand
has stuff like :

class Foo : IBar
{
void Baz() {}

void Boo() {}
}

How can I be absolutely sure IBar is an interface other than reliance on
a
non enforced naming pattern you hope people follow ? How can I tell
whether
Baz or Boo are defiend by IBar or not ?
It this sort of thing that creates an ambivalance in me.

On the one hand I like VBs explicit style. Because it had no implementation
inheritance before becoming VB.NET the language designers have made good
choices in this area especially in relation to overrides and shadows
(hiding). However C# had to attempt to please the C++ people and this
brought some baggage with it in this area.

On the other hand I like the convienience and brevity of the C# syntax.

IOW, the Jedi in me wants to walk the more verbose explicit path of VB but
the Sith wants the easy and conveniant path of C#. ;)

There you go, encouraging someone to use C# over VB is now tantamount to
inviting them to the dark side <snigger>

--
Anthony Jones - MVP ASP/ASP.NET
Aug 21 '08 #37
"Marc" <m.********@removethischello.nlwrote in message
news:eA**************@TK2MSFTNGP06.phx.gbl...
>
"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMwrote

But some things were a bit like 'we don't show
you what really happens since you're to stupid to understand anyway',
Or alternatively 'we don't show you what really happens since you're to
intelligent to want to know you just what us to get on and do was we're told
and not bother you with the details since you have more important things to
do'

There are two sides to most coins.

--
Anthony Jones - MVP ASP/ASP.NET
Aug 21 '08 #38

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: William C. White | last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using cURL? Our website is hosted on a shared drive and the webhost company doesn't installed additional software (such as cURL)...
2
by: Albert Ahtenberg | last post by:
Hello, I don't know if it is only me but I was sure that header("Location:url") redirects the browser instantly to URL, or at least stops the execution of the code. But appearantely it continues...
3
by: James | last post by:
Hi, I have a form with 2 fields. 'A' 'B' The user completes one of the fields and the form is submitted. On the results page I want to run a query, but this will change subject to which...
0
by: Ollivier Robert | last post by:
Hello, I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9 system. The link succeeds but everytime I try to run php, I get a SEGV from inside the libcnltsh.so library. ...
1
by: Richard Galli | last post by:
I want viewers to compare state laws on a single subject. Imagine a three-column table with a drop-down box on the top. A viewer selects a state from the list, and that state's text fills the...
4
by: Albert Ahtenberg | last post by:
Hello, I have two questions. 1. When the user presses the back button and returns to a form he filled the form is reseted. How do I leave there the values he inserted? 2. When the...
1
by: inderjit S Gabrie | last post by:
Hi all Here is the scenerio ...is it possibly to do this... i am getting valid course dates output on to a web which i have designed ....all is okay so far , look at the following web url ...
2
by: Jack | last post by:
Hi All, What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g. select x from y where z=:parameter Which in asp/jsp would be followed by some statements to bind a value...
3
by: Sandwick | last post by:
I am trying to change the size of a drawing so they are all 3x3. the script below is what i was trying to use to cut it in half ... I get errors. I can display the normal picture but not the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.