Hi- I'm new to .Net, a Delphi developer learning C#. What is the scope of
the using statement, or maybe a better question is how do I use it? From the
help, it looks like the scope is within a namespace.
What I have is a class library with several files. One file is a base
class, and then the other 3 files each contain a class that is derived from
the base class. Each class is in its own file, and all classes belong to the
same namespace. I've added references to the base class file:
using BTSComponentsLib;
using System.EnterpriseServices;
using System.Runtime.InteropServices;
using AspenCOM; //In-house unmanaged dll
Since all my classes belong to the same namespace, I am thinking I won't
need to add the using statements to all the files, just the base class file.
Is this reasoning accurate?
thanks,
Jan
javatopia - 02 Dec 2004 15:39 GMT
Hi Jan,
You have to declare the "using" statements in every source file, regardless
of namespace similarity or inheritance.
-- Jake
> Hi- I'm new to .Net, a Delphi developer learning C#. What is the scope of
> the using statement, or maybe a better question is how do I use it? From the
[quoted text clipped - 15 lines]
> thanks,
> Jan
Marina - 02 Dec 2004 15:41 GMT
No. Those are per file. They do nothing except allow you to not have to
type in the fully qualified names of all the classes you will use - they are
just compiler hints, and have nothing to do with inheritance, etc.
> Hi- I'm new to .Net, a Delphi developer learning C#. What is the scope of
> the using statement, or maybe a better question is how do I use it? From the
[quoted text clipped - 15 lines]
> thanks,
> Jan