JScript .NET, Part III: Classes and Namespaces: Telling A Namespace from A Class - Doc JavaScript | WebReference

JScript .NET, Part III: Classes and Namespaces: Telling A Namespace from A Class - Doc JavaScript


JScript .NET, Part III: Classes and Namespaces

Telling a Namespace from a Class

The .NET Framework supports a lot of classes that you can reuse. These classes can help you in creating forms, buttons, text boxes, and almost everything else that may be shared between applications. Classes in the .NET Framework are organized in namespaces. Each namespace includes one or (usually) more classes that are related to each other. The System namespace, for example, includes system-related classes such as Console. The .NET Framework's namespaces are organized in a hierarchical manner. Here are three namespaces which have three-level hierarchical names:

System
System.Web
System.Web.Services

Each of the above three namespaces includes different classes: the System namespace includes system-related classes, the System.Web namespace includes Web-related classes, and the System.Web.Services namespace includes Web services-related classes. There is no inclusion relationship between the three namespaces. The System namespace does not include the System.Web's classes. Similarly, the System.Web.Service's namespace does not include the System.Web's classes.

Namespaces are provided by the .NET Framework for your reuse. You access these namespaces with the import statement. You can also create namespaces by yourself with the package statement. The .NET Framework includes thousands of classes for you, so we cannot list them all here. Just to give you an idea, below is the System namespace hierarchy. Each of these namespaces includes one or more (more likely) classes. Each class has its own methods, properties, and event handlers.

System.Object
   System.Activator
   System.AppDomainSetup ---- System.IAppDomainSetup
   System.Array ---- System.ICloneable, System.Collections.IList,
                     System.Collections.ICollection,
                     System.Collections.IEnumerable
   System.Attribute
      System.AttributeUsageAttribute
      System.CLSCompliantAttribute
      System.ContextStaticAttribute
      System.FlagsAttribute
      System.LoaderOptimizationAttribute
      System.MTAThreadAttribute
      System.NonSerializedAttribute
      System.ObsoleteAttribute
      System.ParamArrayAttribute
      System.SerializableAttribute
      System.STAThreadAttribute
      System.ThreadStaticAttribute
   System.BitConverter
   System.Buffer
   System.CharEnumerator ---- System.Collections.IEnumerator,
     System.ICloneable
   System.Console
   System.Convert
   System.DBNull ---- System.Runtime.Serialization.ISerializable,
     System.IConvertible
   System.Delegate
      System.MulticastDelegate
         System.AssemblyLoadEventHandler
         System.AsyncCallback
         System.CrossAppDomainDelegate
         System.EventHandler
         System.ResolveEventHandler
         System.UnhandledExceptionEventHandler
   System.Environment
   System.EventArgs
      System.AssemblyLoadEventArgs
      System.ResolveEventArgs
      System.UnhandledExceptionEventArgs
   System.Exception
      System.ApplicationException
      System.SystemException
         System.AppDomainUnloadedException
         System.ArgumentException
            System.ArgumentNullException
            System.ArgumentOutOfRangeException
            System.DuplicateWaitObjectException
         System.ArithmeticException
            System.DivideByZeroException
            System.NotFiniteNumberException
            System.OverflowException
         System.ArrayTypeMismatchException
         System.BadImageFormatException
         System.CannotUnloadAppDomainException
         System.ContextMarshalException
         System.ExecutionEngineException
         System.FormatException
            System.UriFormatException
         System.IndexOutOfRangeException
         System.InvalidCastException
         System.InvalidOperationException
            System.ObjectDisposedException
         System.InvalidProgramException
         System.MemberAccessException
            System.FieldAccessException
            System.MethodAccessException
            System.MissingMemberException
               System.MissingFieldException
               System.MissingMethodException
         System.MulticastNotSupportedException
         System.NotImplementedException
         System.NotSupportedException
            System.PlatformNotSupportedException
         System.NullReferenceException
         System.OutOfMemoryException
         System.RankException
         System.StackOverflowException
         System.TypeInitializationException
         System.TypeLoadException
            System.DllNotFoundException
            System.EntryPointNotFoundException
         System.TypeUnloadedException
         System.UnauthorizedAccessException
   System.GC
   System.LocalDataStoreSlot
   System.MarshalByRefObject
      System.AppDomain ---- System._AppDomain,
        System.Security.IEvidenceFactory
      System.ContextBoundObject
      System.Uri ---- System.Runtime.Serialization.ISerializable
   System.Math
   System.OperatingSystem ---- System.ICloneable
   System.Random
   System.Reflection.MemberInfo
      System.Type ---- System.Reflection.IReflect
   System.String ---- System.IComparable, System.ICloneable,
      System.IConvertible, System.Collections.IEnumerable
   System.TimeZone
   System.UriBuilder
   System.ValueType
      System.ArgIterator
      System.Boolean ---- System.IComparable, System.IConvertible
      System.Byte ---- System.IComparable, System.IFormattable,
        System.IConvertible
      System.Char ---- System.IComparable, System.IConvertible
      System.DateTime ---- System.IComparable, System.IFormattable,
        System.IConvertible
      System.Decimal ---- System.IFormattable, System.IComparable,
        System.IConvertible
      System.Double ---- System.IComparable, System.IFormattable,
        System.IConvertible
      System.Enum
         System.AttributeTargets
         System.DayOfWeek
         System.Environment.SpecialFolder
         System.LoaderOptimization
         System.PlatformID
         System.TypeCode
         System.UriHostNameType
         System.UriPartial
      System.Guid ---- System.IFormattable, System.IComparable
      System.Int16 ---- System.IComparable, System.IFormattable,
        System.IConvertible
      System.Int32 ---- System.IComparable, System.IFormattable,
        System.IConvertible
      System.Int64 ---- System.IComparable, System.IFormattable,
        System.IConvertible
      System.IntPtr ---- System.Runtime.Serialization.ISerializable
      System.RuntimeArgumentHandle
      System.RuntimeFieldHandle ----
        System.Runtime.Serialization.ISerializable
      System.RuntimeMethodHandle ----
        System.Runtime.Serialization.ISerializable
      System.RuntimeTypeHandle ----
        System.Runtime.Serialization.ISerializable
      System.SByte ---- System.IComparable, System.IFormattable,
        System.IConvertible
      System.Single ---- System.IComparable, System.IFormattable,
        System.IConvertible
      System.TimeSpan ---- System.IComparable
      System.TypedReference
      System.UInt16 ---- System.IComparable, System.IFormattable,
        System.IConvertible
      System.UInt32 ---- System.IComparable, System.IFormattable,
        System.IConvertible
      System.UInt64 ---- System.IComparable, System.IFormattable,
        System.IConvertible
      System.UIntPtr ---- System.Runtime.Serialization.ISerializable
      System.Void
   System.Version ---- System.ICloneable, System.IComparable
   System.WeakReference ---- System.Runtime.Serialization.ISerializable

Next: How to import namespaces


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: May 6, 2002
Revised: May 6, 2002

URL: http://www.webreference.com/js/column109/2.html