NamespaceInfo Class

Contains a single configuration namespace reference, similar to the Import directive. This class cannot be inherited.

Namespace: System.Web.Configuration
Assembly: System.Web (in system.web.dll)

public sealed class NamespaceInfo : ConfigurationElement
public final class NamespaceInfo extends ConfigurationElement
public final class NamespaceInfo extends ConfigurationElement
Not applicable.

The NamespaceCollection contains NamespaceInfo objects, which correspond to the add elements within the namespaces section. Each NamespaceInfo object is the same as an Import (<%@ Import %>) directive that applies to all pages and controls in the scope of the configuration file. The Import directive allows you to import a namespace into your ASP.NET page, making all its classes available for use on your page.

This example demonstrates how to specify values declaratively for properties of the NamespaceCollection and NamespaceInfo classes.

The following configuration file example shows how to specify values declaratively for the namespaces section.

      <add namespace="System" />
      <add namespace="System.Collections" />
      <add namespace="System.Collections.Specialized" />
      <add namespace="System.ComponentModel" />
      <add namespace="System.Configuration" />
      <add namespace="System.Web" />

The following code example demonstrates how to use the NamespaceInfo class. This code example is part of a larger example provided for the PagesSection class.

// Create a new NamespaceInfo object.
System.Web.Configuration.NamespaceInfo namespaceInfo =
    new System.Web.Configuration.NamespaceInfo("System");

// Set the Namespace property.
namespaceInfo.Namespace = "System.Collections";

// Execute the Add Method.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0