Which namespaces are automatically "used" by .net platform?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

As you might know that "java.lang" package are automatically imported by the
java compiler so that one don't need to write the import statement of that
package in the source code. Are there any packages in .net are automatically
"used" when your are writing a .net application? I am told that Visual Studio
..net automatically include different packages depending on the kind of
applications you are creating. is this true? Will the compilier include any
"default" packages, e.g. "System"?
 
Sparks,
I am told that Visual Studio
.net automatically include different packages depending on the kind of
applications you are creating. is this true? Will the compilier include
any
"default" packages, e.g. "System"?

This is simple to answer

Yes

I hope this helps,

Cor
 
Thanks for your reply Cor, but I still have no idear if any packages are
automatically included. Do you mean VS Studio .net automatically include some
packages depending on the type of application you are creating? Or the
compilier will include some "default" packages? Or did you mean both?

Could you also pls kindly list what packages are automatically included in
by VS Studio.net or/and the compilier?

Thanks very much!
 
sparks said:
As you might know that "java.lang" package are automatically imported by the
java compiler so that one don't need to write the import statement of that
package in the source code. Are there any packages in .net are automatically
"used" when your are writing a .net application? I am told that Visual Studio
.net automatically include different packages depending on the kind of
applications you are creating. is this true? Will the compilier include any
"default" packages, e.g. "System"?

When VS.NET creates a project, it adds various references
automatically, depending on the type of project. You can find that out
by expanding the list of references.

However, C# doesn't include any namespaces by default other than the
namespace of the class you're writing and all "parent" namespaces. (So
if you're writing a class in Foo.Bar, then Foo.Bar, Foo and the unnamed
namespace are all automatically included.)

This is language-specific though - other languages may include
namespaces automatically.
 
Sparks,

When you open by instance a VBNet winforms project than it set automaticly
the resources that it normally needs for that. As well set it the most used
imports (namespaces) in a kind of property file (with C# it sets that in top
of the program files).

When you open an VBNet webapplication, than it will set automaticly other
resources and an other import (However the Microsoft.VisualBasic namespace
is forever included in VBNet while it is never in C#, although you can use
that in the same way as every other namespace in C#)

Than everything is included to make a kind of standard winforms or webforms
application. Do you need more librarys, than you can add those using the
Project->resources. You can than choose to declare the full namespace in
your code or to set an Using (with C) or a Import with VBNet (Acts completly
the same however it needs in C# a ";" at the end).

You can manage a lot of behaviour using the properties from VSNet.

I hope this helps,

Cor
 
Back
Top