Why C#?

M

Marty

Simple question from a simple mind so don't flame me, please.
I am new to .NET and am finishing a class in VB .NET. They try to make
me believe that .NET allows me to program in any language I choose and
end up with the same result or that's how I perceive it. So my question
is what is the advantage to learning C# ? Maybe for job hunting or can
C# do more than VB? I have taken classes in C++ and Java and see the
differences from VB 6 which I taught myself.
 
C

Chris Dunaway

If you scan the groups you will find many discussions on this topic.
Some will say adamantly that VB.Net is better, other will say that C#
is better.

Each language has some features that the other may lack, but IMO, it
just boils down to which syntax you feel most comfortable with. It's
not difficult to learn both after you have become proficient with one
of them, to that's the best course of action IMO.
 
H

Hans Kesting

Simple question from a simple mind so don't flame me, please.
I am new to .NET and am finishing a class in VB .NET. They try to make
me believe that .NET allows me to program in any language I choose and
end up with the same result or that's how I perceive it. So my question
is what is the advantage to learning C# ? Maybe for job hunting or can
C# do more than VB? I have taken classes in C++ and Java and see the
differences from VB 6 which I taught myself.

The .Net environment doesn't force you to use either C# or VB.Net. It's
a matter of personal preference (or the preference of your (future)
employer) what language you choose. You can also use J# (can't call it
java.net) or JScript.Net or ...


Hans Kesting
 
S

Stoitcho Goutsev \(100\)

Marty,

There are huge number of threads on this topic.

It is not completely true that you can do the same things with all
languages. Example: C++ can unbox in the managed heap where for example C#
always copy the unboxed value in the stack, but besides such small things,
yes you are right that you can get the same result from any language.
Actually I think C++ is one big exception because this is the only language
(excluding IL assembler) that can produce mixed assemblies.

Choice of language I believe is more personal, like how confortable one is
withe the language syntax - ease of use and readability. For example I find
C# programs more compact, easy to read than VB.NET and the managed extension
of C++.
Even comming in .NET with big C++ experiance I find the managed extension
very messy and confusing (they say they changed the syntax in .NET2.0 and
now is clearer, but I don't know and frankly don't care).

I personally don't like VB.NET for me it is unreadable and I don't feel that
this my language of choice, but this is just me. If I have used VB before
I'd probably keep using VB.NET.
 
L

Larry Lard

Marty said:
Simple question from a simple mind so don't flame me, please.
I am new to .NET and am finishing a class in VB .NET. They try to make
me believe that .NET allows me to program in any language I choose and
end up with the same result or that's how I perceive it. So my question
is what is the advantage to learning C# ? Maybe for job hunting or can
C# do more than VB? I have taken classes in C++ and Java and see the
differences from VB 6 which I taught myself.

The bottom line (literally as well as figuratively) is that on balance,
_ceteris paribus_*, C# programmers get paid more than VB.NET
programmers. That's it, really.


* which, as the economists say, they never are :)
 
M

Marty

Thanks for the repies.
I guess if C# spells more $ than I guess it's worth taking a look at.
My employer will buy the book if I want. Just to bad my school does'nt
offer a class.
Anybody have a book that's worth recommending?
 
A

Andrew

I have:

"Professional C# 2005" - Wrox

"Programming C#" - O'Reilly

They are a quite good intro to C#.
 
N

nick_nw

Marty said:
Thanks for the repies.
I guess if C# spells more $ than I guess it's worth taking a look at.
My employer will buy the book if I want. Just to bad my school does'nt
offer a class.
Anybody have a book that's worth recommending?

This book is amazing "Applied Microsoft .NET Framework Programming". I
read it 2 years ago and have just finished re-reading it. I think it's
one of those books a c#/.net programmer should never be too far away
from.

The good thing about the book is even though it's C# based it gives you
a thourough understanding of what exactly .Net is, CLR, CLS, Garbage
Collection, boxing, unboxing, types, and even design!

Also, just to echo what's allready been said. In my company there are
only a few .Net programmers and we use C#. Being a C#.Net programmer
gets us some respect from our C/C++ colleagues, but if I said to them I
was a VB.Net programmer they'd probably rank me along side a 15 year
old witha bit of VBA.

Learning C# will also *I think* make it easier for you to learn new
languages that will inevitably appear over the years. I think it's
going to be a long long time before we move away from the K&R style {}
of syntax.

Nick
 
D

Dylan Parry

Pondering the eternal question of "Hobnobs or Rich Tea?", Andrew finally
proclaimed:
"Programming C#" - O'Reilly

I'll second that. It usually sits no more than a foot away from me
whilst I'm programming! It's far from a complete reference though.
 
C

Chris Dunaway

nick_nw said:
This book is amazing "Applied Microsoft .NET Framework Programming". I
read it 2 years ago and have just finished re-reading it. I think it's
one of those books a c#/.net programmer should never be too far away
from.

There is a new version of this book out that covers .Net 2.0
 
A

Alvin Bruney

C# programs more compact, easy to read than VB.NET and >the managed
extension of C++.
This is not consistently true btw. For instance, C# applications are
horribly bloated for MS Office automation due in part to the history of the
underlying COM objects and the fact that C# lacks some support where VB.NET
does.

Perhaps the bottom line is to choose a language that your employer uses.
Resistance would not be wise.


--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------
 
J

Jason Newell

"C# lacks some support where VB.NET does"

Alvin,

Care to expand on that? While I don't do a lot of Office Automation, I
do deal with COM Interop in both languages every day. The only thing
that I can think of that you're talking about is that VB allows you to
call methods \ properties on non-strongly typed objects whereas C#
you'll use Reflection. And if I had to guess, VB.NET is using
Reflection behind the scenes anyway.

I'm just curious what you meant.

Jason Newell
 
T

tdavisjr

"C# lacks some support where VB.NET does"

Oh Boy! Its starting all over again. Its been 5 years now, haven't we
all been over this. Microsoft have gone through all the work to make
the .NET framework language independent; but at what cost. Guys, if
you like curly brackets, square brackets and semi-colons, then C# is
for you. If you like to write code that seems like you are writing
pseudo-code (i.e. in plain English) then VB.NET is for you. Lastly, if
you want to be diverse and a skilled .NET developer then learn BOTH.
 
J

Jason Newell

I have learned both languages. My preference is irrelevant and I did
not express it. I'm simply trying to understand the comment. I have an
interest in the answer because if VB.NET in fact does COM Interop better
than C#, I need to know about it and understand the differences. I feel
that I'm very verse in COM Interop so I'd really like to hear the answer.

Jason
 
S

Stoitcho Goutsev \(100\)

Alvin,

I'd never apply for VB programming job, so this is not an issue for me. I
can still do some very small VB programming, such as sample application, but
that is as far as it goes.


--
HTH
Stoitcho Goutsev (100)


Alvin Bruney said:
C# programs more compact, easy to read than VB.NET and >the managed
extension of C++.
This is not consistently true btw. For instance, C# applications are
horribly bloated for MS Office automation due in part to the history of
the underlying COM objects and the fact that C# lacks some support where
VB.NET does.

Perhaps the bottom line is to choose a language that your employer uses.
Resistance would not be wise.


--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
 
T

tdavisjr

VB in general does a better job with Late Binding since the language
compiler permits it. So, it goes hand in hand with COM since COM is
Interface based and therefore uses late binding calls by nature. C# on
the other hand is a strict typed language and the C# compiler enfores
that.

By the way, my original post wasn't meant for you but for the goup as a
whole. :)
 
J

Jon Skeet [C# MVP]

Jason Newell said:
I have learned both languages. My preference is irrelevant and I did
not express it. I'm simply trying to understand the comment. I have an
interest in the answer because if VB.NET in fact does COM Interop better
than C#, I need to know about it and understand the differences. I feel
that I'm very verse in COM Interop so I'd really like to hear the answer.

I believe it's just a case of VB.NET supporting optional parameters and
"loose typing" (i.e. turning option strict off when dealing with
interfaces which don't actually give much useful information.
 
A

Alvin Bruney

I believe it's just a case of VB.NET supporting optional parameters and
"loose typing"
That's about the sum of it. But while i'm here, i'll add that .NET enforces
pass by value semantics. For MS Word (not Excel) API require pass by
reference, C# stumbles because these objects require a reference be added
everytime. Imagine typing ref 30 times in order to satisfy the compiler for
the open workbook method?

Further, only lvalues can be passed by reference otherwise the compiler
barks really loudly. The sum total of this results in an exercise of torture
for C# developers building real world Office apps in .NET.

C# also stumbles for properties that accept more than one parameter while VB
handles this with grace. In fact, you will see numerous get_object and
set_object methods in C# for the Office PIA's to fix this evil. A couple
other things can go here as well but it's enough to bake the point in.

Although the literature will not come out and explicitly tell you so, it is
wise to avoid C# for Office based apps because it is inferior for Office
automation in the current context.
--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
 
J

Jason Newell

Alvin & All,

Thanks for the responses. My main source of COM Interop interaction is
via CAD applications. I develop solutions using both C# & VB.NET and I
guess I just hadn't noticed that big of a difference that would make me
say one language handles COM Interop better than the other.

I guess I just got hung up on the "C# lacks some support where VB.NET
does". When I read it, it implied to me that VB.NET can accomplish COM
Interop tasks that C# can't. They can both accomplish the same tasks,
but sometimes using different methods. All that said, I now understand
your scenerio.

Thanks for the input.

Jason Newell
 
W

Willy Denoyette [MVP]

Note that Office applications are COM automation servers, they were designed
to be scripted, that is, the interfaces are to be consumed by (late bound)
scripting clients like VBScript and non scripting (late & early bound)
languages like VBA, VB and C++ which all do support late binding, optional
and named arguments.
Apparently, the C# team (rightfully) assumed that VB.NET would become the
language of choice for the task at hand, so they didn't implement the
features at the compiler level like VB.NET and JScript.NET did.

Willy.



| Alvin & All,
|
| Thanks for the responses. My main source of COM Interop interaction is
| via CAD applications. I develop solutions using both C# & VB.NET and I
| guess I just hadn't noticed that big of a difference that would make me
| say one language handles COM Interop better than the other.
|
| I guess I just got hung up on the "C# lacks some support where VB.NET
| does". When I read it, it implied to me that VB.NET can accomplish COM
| Interop tasks that C# can't. They can both accomplish the same tasks,
| but sometimes using different methods. All that said, I now understand
| your scenerio.
|
| Thanks for the input.
|
| Jason Newell
|
| Alvin Bruney wrote:
| >>I believe it's just a case of VB.NET supporting optional parameters and
| >>"loose typing"
| >
| > That's about the sum of it. But while i'm here, i'll add that .NET
enforces
| > pass by value semantics. For MS Word (not Excel) API require pass by
| > reference, C# stumbles because these objects require a reference be
added
| > everytime. Imagine typing ref 30 times in order to satisfy the compiler
for
| > the open workbook method?
| >
| > Further, only lvalues can be passed by reference otherwise the compiler
| > barks really loudly. The sum total of this results in an exercise of
torture
| > for C# developers building real world Office apps in .NET.
| >
| > C# also stumbles for properties that accept more than one parameter
while VB
| > handles this with grace. In fact, you will see numerous get_object and
| > set_object methods in C# for the Office PIA's to fix this evil. A couple
| > other things can go here as well but it's enough to bake the point in.
| >
| > Although the literature will not come out and explicitly tell you so, it
is
| > wise to avoid C# for Office based apps because it is inferior for Office
| > automation in the current context.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top