Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How come I don't need to reference "System.dll" to use the "System" namespace?

I am working on an assignment that specified "Do not use any external libraries". So I created a c# application, and the first thing I did was remove all the dll's references by default... including "System.dll".

However, I can still add this to my code:

using System;
using System.IO;

I was just curious as to how come I do not need to have System.dll as a reference in my project to do this. Thanks!

like image 775
ntsue Avatar asked Jul 19 '12 11:07

ntsue


People also ask

Is namespace a DLL?

Think of namespaces as "folders" that contain one or more classes, and that might be defined in one or more assemblies (DLLs). For example, Classes inside the System namespace are defined in 2 assemblies (DLLs): mscorlib. dll and System.

Can a DLL reference another DLL?

Can a DLL reference another DLL? Any DLL that lays somewhere in file system can be referenced. After compilation this DLL must be either in GAC (Global Assembly Cache) or in same directory with the working application.

Is System a namespace?

The System namespace is the root of all namespaces in the . NET Framework, containing all other namespaces as subordinates.


1 Answers

mscorlib.dll includes items in both those namespaces.

You need to right-click your project > Properties > Build > Advanced... and check "Do not reference mscorlib.dll" to remove this reference.

like image 98
Rawling Avatar answered Oct 05 '22 04:10

Rawling