Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / December 2004

Tip: Looking for answers? Try searching our database.

Scope of Using Statement?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jan - 02 Dec 2004 15:31 GMT
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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.