Mads Peter Nymand <ma*******@oncable.dk> wrote:
Thanks a lot for your answer.
Maybe the command prompt compiler is set to include the full C# 2.0
Class Library the same way, that the Java command line compiler is set
to include the full java API class library.
No - it's set to include a certain set of assemblies. (The difference
is that with Java, all the standard libraries are in one big jar file -
rt.jar.)
If you look in your .NET framework directory, find a file called
csc.rsp. That lists the command-line options which are specified by
default.
It raises a new question though:
In the command prompt and in the Java IDEs I have used, the whole API
class library of the SDK is included by default. Why isn't it so in VS.
Why do you have such a limited set of references in a C# project in VS?
Because Java doesn't really have "references" to start with. You can
put lots of things on a classpath, but it's not really the same thing.
Instead, it's got a huge standard library in one big file. That's not
really great from an organisational perspective.
In the top of a file, you are declaring which namespaces to use. That
makes sense, because you have to define, which namespaces the classes
you are using, are belonging to. In my opinion, it does not make sense,
that you have to define new references (add refernces) at project
level, when you are using namespaces, that is part of the standard C#
library. That's just extra work for no reason. Can anybody give me a
reason why it is so - better stucture? faster execution? - something
Firstly, it's not the standard C# library - it's the standard .NET
framework. C# is just *one* language targetting the .NET framework.
Secondly, namespaces and assemblies are very different things. An
assembly often happens to have types within a namespaces of a similar
name to the assemblies, but they're different to namespaces.
"using" directives just provide shortcuts so you don't need to type the
full name of every type you're using. Assembly references govern which
types are available in the first place.
The .NET framework is better organised than Java in terms of the
standard library being broken up into separate units of functionality.
If you don't need anything to do with System.Messaging, why make either
the compiler or the runtime load that assembly?
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog:
http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too