NamespaceCollection クラス

定義

名前空間オブジェクトのコレクションを格納します。 このクラスは継承できません。

public ref class NamespaceCollection sealed : System::Configuration::ConfigurationElementCollection
[System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.NamespaceInfo))]
public sealed class NamespaceCollection : System.Configuration.ConfigurationElementCollection
[<System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.NamespaceInfo))>]
type NamespaceCollection = class
    inherit ConfigurationElementCollection
Public NotInheritable Class NamespaceCollection
Inherits ConfigurationElementCollection
継承
属性

次の構成ファイルの抜粋は、 NamespaceCollection クラスのいくつかのプロパティの値を宣言によって指定する方法を示しています。

<system.web>
  <pages>
    <namespaces>
      <add namespace="System" />
      <add namespace="System.Collections" />
      <add namespace="System.Collections.Specialized" />
      <add namespace="System.ComponentModel" />
      <add namespace="System.Configuration" />
      <add namespace="System.Web" />
    </namespaces>
  </pages>
</system.web>

次のコード例は、 NamespaceCollection 型の使用方法を示しています。 このコード例は、 PagesSection クラスに提供されるより大きな例の一部です。

       // Get the AutoImportVBNamespace property.
       Console.WriteLine("AutoImportVBNamespace: '{0}'",
           pagesSection.Namespaces.AutoImportVBNamespace.ToString());

       // Set the AutoImportVBNamespace property.
       pagesSection.Namespaces.AutoImportVBNamespace = true;

       // Get all current Namespaces in the collection.
       for (int i = 0; i < pagesSection.Namespaces.Count; i++)
       {
         Console.WriteLine(
             "Namespaces {0}: '{1}'", i,
             pagesSection.Namespaces[i].Namespace);
       }

       // 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.
       pagesSection.Namespaces.Add(namespaceInfo);

       // Add a NamespaceInfo object using a constructor.
       pagesSection.Namespaces.Add(
           new System.Web.Configuration.NamespaceInfo(
           "System.Collections.Specialized"));

       // Execute the RemoveAt method.
       pagesSection.Namespaces.RemoveAt(0);

       // Execute the Clear method.
       pagesSection.Namespaces.Clear();

       // Execute the Remove method.
       pagesSection.Namespaces.Remove("System.Collections");

       // Get the current AutoImportVBNamespace property value.
       Console.WriteLine(
           "Current AutoImportVBNamespace value: '{0}'",
           pagesSection.Namespaces.AutoImportVBNamespace);

       // Set the AutoImportVBNamespace property to false.
       pagesSection.Namespaces.AutoImportVBNamespace = false;
' Get the AutoImportVBNamespace property.
Console.WriteLine( _
 "AutoImportVBNamespace: '{0}'", _
 pagesSection.Namespaces.AutoImportVBNamespace)

' Set the AutoImportVBNamespace property.
pagesSection.Namespaces.AutoImportVBNamespace = True

' Get all current Namespaces in the collection.
Dim i As Int16
For i = 0 To pagesSection.Namespaces.Count - 1
  Console.WriteLine( _
   "Namespaces {0}: '{1}'", i, _
   pagesSection.Namespaces(i).Namespace)
Next

' Create a new NamespaceInfo object.
Dim namespaceInfo As System.Web.Configuration.NamespaceInfo = _
 New System.Web.Configuration.NamespaceInfo("System")

' Set the Namespace property.
namespaceInfo.Namespace = "System.Collections"

' Execute the Add Method.
pagesSection.Namespaces.Add(namespaceInfo)

' Add a NamespaceInfo object using a constructor.
pagesSection.Namespaces.Add( _
 New System.Web.Configuration.NamespaceInfo( _
 "System.Collections.Specialized"))

' Execute the RemoveAt method.
pagesSection.Namespaces.RemoveAt(0)

' Execute the Clear method.
pagesSection.Namespaces.Clear()

' Execute the Remove method.
pagesSection.Namespaces.Remove("System.Collections")

' Get the current AutoImportVBNamespace property value.
Console.WriteLine( _
 "Current AutoImportVBNamespace value: '{0}'", _
 pagesSection.Namespaces.AutoImportVBNamespace)

' Set the AutoImportVBNamespace property to false.
pagesSection.Namespaces.AutoImportVBNamespace = False

注釈

NamespaceCollectionには、NamespaceInfoオブジェクトが含まれています。 各 NamespaceInfo オブジェクトは、構成ファイルのスコープ内のすべてのページとコントロールに適用される Import (<%@ Import %>) ディレクティブと同じです。 Import ディレクティブを使用すると、名前空間を ASP.NET ページにインポートして、そのすべてのクラスをページで使用できるようになります。

コンストラクター

名前 説明
NamespaceCollection()

NamespaceCollection クラスの新しいインスタンスを初期化します。

プロパティ

名前 説明
AddElementName

派生クラスでオーバーライドされたときに ConfigurationElement の追加操作に関連付ける ConfigurationElementCollection の名前を取得または設定します。

(継承元 ConfigurationElementCollection)
AutoImportVBNamespace

Visual Basic 名前空間を指定せずにインポートするかどうかを決定する値を取得または設定します。

ClearElementName

派生クラスでオーバーライドされたときに ConfigurationElement のクリア操作に関連付ける ConfigurationElementCollection の名前を取得または設定します。

(継承元 ConfigurationElementCollection)
CollectionType

ConfigurationElementCollectionの型を取得します。

(継承元 ConfigurationElementCollection)
Count

コレクション内の要素の数を取得します。

(継承元 ConfigurationElementCollection)
CurrentConfiguration

現在のConfiguration インスタンスが属している構成階層を表す最上位ConfigurationElement インスタンスへの参照を取得します。

(継承元 ConfigurationElement)
ElementInformation

ElementInformation オブジェクトのカスタマイズ不可能な情報と機能を含むConfigurationElement オブジェクトを取得します。

(継承元 ConfigurationElement)
ElementName

派生クラスでオーバーライドされたときに、構成ファイル内の要素のこのコレクションを識別するために使用される名前を取得します。

(継承元 ConfigurationElementCollection)
ElementProperty

ConfigurationElementProperty オブジェクト自体を表すConfigurationElement オブジェクトを取得します。

(継承元 ConfigurationElement)
EmitClear

コレクションがクリアされているかどうかを示す値を取得または設定します。

(継承元 ConfigurationElementCollection)
EvaluationContext

ContextInformation オブジェクトの ConfigurationElement オブジェクトを取得します。

(継承元 ConfigurationElement)
HasContext

CurrentConfiguration プロパティがnullされているかどうかを示す値を取得します。

(継承元 ConfigurationElement)
IsSynchronized

コレクションへのアクセスが同期されているかどうかを示す値を取得します。

(継承元 ConfigurationElementCollection)
Item[ConfigurationProperty]

この構成要素のプロパティまたは属性を取得または設定します。

(継承元 ConfigurationElement)
Item[Int32]

コレクション内の指定したインデックス位置にある NamespaceInfo オブジェクトを取得または設定します。

Item[String]

この構成要素のプロパティ、属性、または子要素を取得または設定します。

(継承元 ConfigurationElement)
LockAllAttributesExcept

ロックされた属性のコレクションを取得します。

(継承元 ConfigurationElement)
LockAllElementsExcept

ロックされた要素のコレクションを取得します。

(継承元 ConfigurationElement)
LockAttributes

ロックされた属性のコレクションを取得します。

(継承元 ConfigurationElement)
LockElements

ロックされた要素のコレクションを取得します。

(継承元 ConfigurationElement)
LockItem

要素がロックされているかどうかを示す値を取得または設定します。

(継承元 ConfigurationElement)
Properties

プロパティのコレクションを取得します。

(継承元 ConfigurationElement)
RemoveElementName

派生クラスでオーバーライドされたときに ConfigurationElement の削除操作に関連付ける ConfigurationElementCollection の名前を取得または設定します。

(継承元 ConfigurationElementCollection)
SyncRoot

ConfigurationElementCollectionへのアクセスを同期するために使用するオブジェクトを取得します。

(継承元 ConfigurationElementCollection)
ThrowOnDuplicate

重複する ConfigurationElementConfigurationElementCollection に追加しようとすると例外がスローされるかどうかを示す値を取得します。

(継承元 ConfigurationElementCollection)

メソッド

名前 説明
Add(NamespaceInfo)

NamespaceInfo オブジェクトをコレクションに追加します。

BaseAdd(ConfigurationElement, Boolean)

構成要素コレクションに構成要素を追加します。

(継承元 ConfigurationElementCollection)
BaseAdd(ConfigurationElement)

構成要素を ConfigurationElementCollectionに追加します。

(継承元 ConfigurationElementCollection)
BaseAdd(Int32, ConfigurationElement)

構成要素コレクションに構成要素を追加します。

(継承元 ConfigurationElementCollection)
BaseClear()

すべての構成要素オブジェクトをコレクションから削除します。

(継承元 ConfigurationElementCollection)
BaseGet(Int32)

指定したインデックス位置にある構成要素を取得します。

(継承元 ConfigurationElementCollection)
BaseGet(Object)

指定したキーを持つ構成要素を返します。

(継承元 ConfigurationElementCollection)
BaseGetAllKeys()

ConfigurationElementCollectionに含まれるすべての構成要素のキーの配列を返します。

(継承元 ConfigurationElementCollection)
BaseGetKey(Int32)

指定したインデックス位置にある ConfigurationElement のキーを取得します。

(継承元 ConfigurationElementCollection)
BaseIndexOf(ConfigurationElement)

指定した ConfigurationElementのインデックスを示します。

(継承元 ConfigurationElementCollection)
BaseIsRemoved(Object)

指定したキーを持つ ConfigurationElementConfigurationElementCollectionから削除されたかどうかを示します。

(継承元 ConfigurationElementCollection)
BaseRemove(Object)

コレクションから ConfigurationElement を削除します。

(継承元 ConfigurationElementCollection)
BaseRemoveAt(Int32)

指定したインデックス位置にある ConfigurationElement を削除します。

(継承元 ConfigurationElementCollection)
Clear()

コレクションからすべての NamespaceInfo オブジェクトを削除します。

CopyTo(ConfigurationElement[], Int32)

ConfigurationElementCollection の内容を配列にコピーします。

(継承元 ConfigurationElementCollection)
CreateNewElement()

派生クラスでオーバーライドされた場合は、新しい ConfigurationElementを作成します。

(継承元 ConfigurationElementCollection)
CreateNewElement(String)

派生クラスでオーバーライドされたときに新しい ConfigurationElement を作成します。

(継承元 ConfigurationElementCollection)
DeserializeElement(XmlReader, Boolean)

構成ファイルから XML を読み取ります。

(継承元 ConfigurationElement)
Equals(Object)

指定したオブジェクトと ConfigurationElementCollection を比較します。

(継承元 ConfigurationElementCollection)
GetElementKey(ConfigurationElement)

派生クラスでオーバーライドされた場合に、指定した構成要素の要素キーを取得します。

(継承元 ConfigurationElementCollection)
GetEnumerator()

IEnumeratorを反復処理するために使用されるConfigurationElementCollectionを取得します。

(継承元 ConfigurationElementCollection)
GetHashCode()

ConfigurationElementCollection インスタンスを表す一意の値を取得します。

(継承元 ConfigurationElementCollection)
GetTransformedAssemblyString(String)

指定したアセンブリ名の変換されたバージョンを返します。

(継承元 ConfigurationElement)
GetTransformedTypeString(String)

指定した型名の変換されたバージョンを返します。

(継承元 ConfigurationElement)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
Init()

ConfigurationElement オブジェクトを初期状態に設定します。

(継承元 ConfigurationElement)
InitializeDefault()

ConfigurationElement オブジェクトの既定の値セットを初期化するために使用します。

(継承元 ConfigurationElement)
IsElementName(String)

指定した ConfigurationElementConfigurationElementCollectionに存在するかどうかを示します。

(継承元 ConfigurationElementCollection)
IsElementRemovable(ConfigurationElement)

指定した ConfigurationElementConfigurationElementCollectionから削除できるかどうかを示します。

(継承元 ConfigurationElementCollection)
IsModified()

この ConfigurationElementCollection が最後に保存されてから変更されたか、派生クラスでオーバーライドされたときに読み込まれたかを示します。

(継承元 ConfigurationElementCollection)
IsReadOnly()

ConfigurationElementCollection オブジェクトが読み取り専用かどうかを示します。

(継承元 ConfigurationElementCollection)
ListErrors(IList)

この ConfigurationElement オブジェクトおよびすべてのサブ要素の無効なプロパティ エラーを、渡されたリストに追加します。

(継承元 ConfigurationElement)
MemberwiseClone()

現在の Objectの簡易コピーを作成します。

(継承元 Object)
OnDeserializeUnrecognizedAttribute(String, String)

逆シリアル化中に不明な属性が検出されたかどうかを示す値を取得します。

(継承元 ConfigurationElement)
OnDeserializeUnrecognizedElement(String, XmlReader)

構成システムが例外をスローします。

(継承元 ConfigurationElementCollection)
OnRequiredPropertyNotFound(String)

必要なプロパティが見つからない場合に例外をスローします。

(継承元 ConfigurationElement)
PostDeserialize()

逆シリアル化後に呼び出されます。

(継承元 ConfigurationElement)
PreSerialize(XmlWriter)

シリアル化の前に呼び出されます。

(継承元 ConfigurationElement)
Remove(String)

指定したキーを持つ NamespaceInfo オブジェクトをコレクションから削除します。

RemoveAt(Int32)

コレクション内の指定したインデックスから ProfileGroupSettings オブジェクトを削除します。

Reset(ConfigurationElement)

派生クラスでオーバーライドされると、ConfigurationElementCollection を変更されていない状態にリセットします。

(継承元 ConfigurationElementCollection)
ResetModified()

派生クラスでオーバーライドされたときに、IsModified() プロパティの値を false にリセットします。

(継承元 ConfigurationElementCollection)
SerializeElement(XmlWriter, Boolean)

派生クラスでオーバーライドされると、構成データを構成ファイルの XML 要素に書き込みます。

(継承元 ConfigurationElementCollection)
SerializeToXmlElement(XmlWriter, String)

派生クラスで実装されるときに、この構成要素の外部タグを構成ファイルに書き込みます。

(継承元 ConfigurationElement)
SetPropertyValue(ConfigurationProperty, Object, Boolean)

プロパティを指定した値に設定します。

(継承元 ConfigurationElement)
SetReadOnly()

IsReadOnly() オブジェクトとすべてのサブ要素の ConfigurationElementCollection プロパティを設定します。

(継承元 ConfigurationElementCollection)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)
Unmerge(ConfigurationElement, ConfigurationElement, ConfigurationSaveMode)

構成階層のさまざまなレベルから構成情報をマージする効果を元に戻します。

(継承元 ConfigurationElementCollection)

明示的なインターフェイスの実装

名前 説明
ICollection.CopyTo(Array, Int32)

ConfigurationElementCollection を配列にコピーします。

(継承元 ConfigurationElementCollection)

拡張メソッド

名前 説明
AsParallel(IEnumerable)

クエリの並列化を有効にします。

AsQueryable(IEnumerable)

IEnumerableIQueryableに変換します。

Cast<TResult>(IEnumerable)

IEnumerable の要素を指定した型にキャストします。

OfType<TResult>(IEnumerable)

指定した型に基づいて、IEnumerable の要素をフィルター処理します。

適用対象

こちらもご覧ください