NAMESPACE Namespaces Namespaces are a way to define

  • Slides: 9
Download presentation
NAMESPACE

NAMESPACE

Namespaces • Namespaces are a way to define the classes and other types of

Namespaces • Namespaces are a way to define the classes and other types of information into one hierarchical structure. • System is the basic namespace used by every. NET code. • If we can explore the System namespace little bit, we can see it has lot of namespace that uses the system namespace. • For example, System. IO, System. Net, System. Collections, System. Threading, etc. • A namespace can be created via the Namespace keyword.

The Namespace Hierarchy and Fully-Qualified Names • For example, the Button type is contained

The Namespace Hierarchy and Fully-Qualified Names • For example, the Button type is contained in the System. Windows. Forms namespace.

Namespace 1 Public Class 1 'class code End Class End Namespace

Namespace 1 Public Class 1 'class code End Class End Namespace

 • Imports alias directives. • A Imports-alias-directive introduces an identifier that serves as

• Imports alias directives. • A Imports-alias-directive introduces an identifier that serves as an alias for a namespace or type within the immediately enclosing compilation unit or namespace body. Imports identifier = namespace-or-type-name; • Within member declarations in a compilation unit , the identifier introduced by the Imports-aliasdirective can be used to reference the given namespace or type.

 • Some Namespaces and their use: • System: Includes essential classes and base

• Some Namespaces and their use: • System: Includes essential classes and base classes for commonly used data types, events, exceptions and so on • System. Collections: Includes classes and interfaces that define various collection of objects such as list, queues, hash tables, arrays, etc • System. Data: Includes classes which lets us handle data from data sources • System. Data. Ole. Db: Includes classes that support the OLEDB. NET provider • System. Data. Sql. Client: Includes classes that support the SQL Server. NET provider • System. Diagnostics: Includes classes that allow to debug our application and to step through our code

 • System. Drawing: Provides access to drawing methods • System. Globalization: Includes classes

• System. Drawing: Provides access to drawing methods • System. Globalization: Includes classes that specify culture-related information • System. IO: Includes classes for data access with Files • System. Net: Provides interface to protocols used on the internet • System. Reflection: Includes classes and interfaces that return information about types, methods and fields • System. Security: Includes classes to support the structure of common language runtime security system

 • System. Threading: Includes classes and interfaces to support multithreaded applications • System.

• System. Threading: Includes classes and interfaces to support multithreaded applications • System. Web: Includes classes and interfaces that support browser-server communication • System. Web. Services: Includes classes that let us build and use Web Services • System. Windows. Forms: Includes classes for creating Windows based forms • System. XML: Includes classes for XML support