very newbie question

J

John Salerno

Hi all. I'm currently reading Charles Petzold's Programming in the Key
of C#, and I'm a little confused. I understand that this book (at least
so far) is covering the very basics, but all of the code used thus far
in the book has been taken from the .NET Framework reference library
(System.Console.WriteLine, and plenty of other methods taken from the
System namespace).

What I'm wondering is, where is the code that is actually exclusive to
C#? It seems like everything I'm seeing so far is from the .NET
'language' (I know it's not a real programming language though) and I'm
not seeing anything from C# except keywords and data types. Is this
because C# is so closely connected to the .NET Framework, or do all the
languages (C++, VB, etc.) use a lot of these calls to the .NET Framework?

Hope that made some sense. I still have half the book left to read, and
maybe as it gets more advanced, I'll start seeing the C#-only code
(i.e., things you wouldn't write in the other languages in the same way).
 
P

Philipp Schumann

Hi John,

this is more or less "by design" -- most of the functionality in the base
class libraries are just "general purpose" and thus available to all
languages. Indeed, while every language can have its own syntax elements,
they all need to be object-oriented so that they can consume and provide
object-oriented class libraries for the framework.

After all, why should every language have a newly implemented
Console.WriteLine mechanism---it remains the same functionality, so there
would be no point.

There are some significant differences in the languages though, for example,
in C# you can do operator overloading which isn't possible in VB (unless
you're using .NET 2.0). Also C# has a "using" construct which VB.NET
doesn't, while VB has a "With" construct which doesn't exist in C#. (The two
have very different purposes, BTW.)

Enjoy your early C# adventures!
 
J

John Salerno

Philipp said:
Hi John,

this is more or less "by design" -- most of the functionality in the base
class libraries are just "general purpose" and thus available to all
languages. Indeed, while every language can have its own syntax elements,
they all need to be object-oriented so that they can consume and provide
object-oriented class libraries for the framework.

After all, why should every language have a newly implemented
Console.WriteLine mechanism---it remains the same functionality, so there
would be no point.

There are some significant differences in the languages though, for example,
in C# you can do operator overloading which isn't possible in VB (unless
you're using .NET 2.0). Also C# has a "using" construct which VB.NET
doesn't, while VB has a "With" construct which doesn't exist in C#. (The two
have very different purposes, BTW.)

Enjoy your early C# adventures!

Thanks! So far so good, because I'm still in the basics. It's such an
interesting topic, and I can't wait for the new versions of VS to be
released, although I know I have plenty to work with even without
Windows or Web Forms yet!
 
O

Olaf Baeyens

What I'm wondering is, where is the code that is actually exclusive to
C#? It seems like everything I'm seeing so far is from the .NET
'language' (I know it's not a real programming language though) and I'm
not seeing anything from C# except keywords and data types. Is this
because C# is so closely connected to the .NET Framework, or do all the
languages (C++, VB, etc.) use a lot of these calls to the .NET Framework?
The keywords and datatypes IS the C# language. The rest is part of the .NET
framework and happens to be used by the other .NET languages too.
 
J

John Salerno

Olaf said:
The keywords and datatypes IS the C# language. The rest is part of the .NET
framework and happens to be used by the other .NET languages too.

So does that mean that all the .NET languages use basically the same code?
 
O

Olaf Baeyens

What I'm wondering is, where is the code that is actually exclusive to
So does that mean that all the .NET languages use basically the same code?
The .NET framework part yes.
VB.NET, C#, managed C++ uses the same .NET framework, so they all share the
same bugs too.

And if you create a C# assembly (.NET DLL) then it can be used in VB.NET and
managed C++ too and the reverse.
Only the VB.NET could have problems reading the C# asselbly (dll) because it
might be case sensitive. But if you follow the conventions then any .NET
assembly created in any .NET language can be used intermixed.

It looks a little like those ActiveX components, only these DLL components
can be created in a stupid simple way compared to ActiveX.
 

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