Groups | Blog | Home
all groups > dotnet sdk > july 2004 >

dotnet sdk : does a references, but unused, namesapce consume resources?



KoolistOne
7/28/2004 3:20:11 PM
I have a template that I would like to include a namespace in but I won't be using that referenced namespace til a few months from now. In the mean time, will that referenced, but not used/called namespace consume any resources?

The template is going to be used by many people who will modify it to their use now, later when we roll out a new feature which will consume that namespace, they will
1. be set to go if we include the reference to that name space now
2. have to add it to their template for future work
3. have to add it to all their templates and subset scripts written from the template we provided.

The goal here is to create the least amount of work. But I don't want to be consuming any unnecessary resources if I can help it

Thanks for any help on this.

--
Christian Heide Damm
7/29/2004 1:13:14 PM
Is the referenced namespace defined in a separate assembly or in the same
assembly as the template?

If it's in the same assembly, then obviously, the code in the namespace will
be compiled into the assembly and thus take up disk space, but not more than
that.

If it's in a different assembly, and you really don't use anything in the
referenced assembly, then the template assembly won't even contain a
reference to the referenced assembly (open the template assembly with
ildasm.exe, open the manifest, and see that it contains referenced to
System.dll etc. but not unused assembly). Even if you have a using statement
or something to the referenced assembly, it won't consume resources if you
never instantiate any types in it.

Conclusion: it won't consume resources as long as you don't use it.

Christian


[quoted text, click to view]
be using that referenced namespace til a few months from now. In the mean
time, will that referenced, but not used/called namespace consume any
resources?
[quoted text, click to view]
their use now, later when we roll out a new feature which will consume that
namespace, they will
[quoted text, click to view]

Jon Skeet [C# MVP]
7/29/2004 2:06:43 PM
[quoted text, click to view]

That depends whether you're using VB.NET or C#. If you use C#, unused
references don't end up in the manifest. If you're using VB.NET, they
do (currently).

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
AddThis Social Bookmark Button