次の方法で共有


ConfigurationLocationCollection クラス

定義

ConfigurationLocationCollection オブジェクトのコレクションを格納します。

public ref class ConfigurationLocationCollection : System::Collections::ReadOnlyCollectionBase
public class ConfigurationLocationCollection : System.Collections.ReadOnlyCollectionBase
type ConfigurationLocationCollection = class
    inherit ReadOnlyCollectionBase
Public Class ConfigurationLocationCollection
Inherits ReadOnlyCollectionBase
継承
ConfigurationLocationCollection

次のコード例では、アプリケーション MySampleAppの Web 構成が読み込まれ、この構成で定義されている場所は、Locations プロパティによって返されるConfigurationLocationCollection オブジェクトを反復処理することによって表示されます。

using System;
using System.Collections;
using System.Configuration;

class DisplayLocationInfo
{
    static void Main(string[] args)
    {
        Configuration config = 
            ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
        ConfigurationLocationCollection myLocationCollection = config.Locations;
        foreach (ConfigurationLocation myLocation in myLocationCollection)
        {
            Console.WriteLine("Location Path: {0}", myLocation.Path);
            Configuration myLocationConfiguration = myLocation.OpenConfiguration();
            Console.WriteLine("Location Configuration File Path: {0}",
                myLocationConfiguration.FilePath);
        }
        Console.WriteLine("Done...");
        Console.ReadLine();
    }
}
Imports System.Collections
Imports System.Configuration

Class DisplayLocationInfo
    Public Overloads Shared Sub Main()
        Dim config As System.Configuration.Configuration = _
            ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
        Dim myLocationCollection As _
            System.Configuration.ConfigurationLocationCollection = config.Locations
        Dim myLocation As ConfigurationLocation
        For Each myLocation In  myLocationCollection
            Console.WriteLine("Location Path: {0}", myLocation.Path)
            Dim myLocationConfiguration As System.Configuration.Configuration = _
                myLocation.OpenConfiguration()
            Console.WriteLine("Location Configuration Path: {0}", _
                myLocationConfiguration.FilePath)
        Next myLocation
        Console.WriteLine("Done...")
        Console.ReadLine()
    End Sub
End Class

注釈

ConfigurationLocationCollection クラスを使用して、場所固有の構成設定が定義されているリソースを表すConfigurationLocation オブジェクトのコレクションを反復処理します。 ConfigurationLocationCollection は、 Locations プロパティによって返される型です。

ConfigurationLocationCollection クラスは、構成ファイルで指定された順序でConfigurationLocation オブジェクトのコレクションを参照しない可能性があります。

プロパティ

名前 説明
Count

ReadOnlyCollectionBase インスタンスに含まれる要素の数を取得します。

(継承元 ReadOnlyCollectionBase)
InnerList

ReadOnlyCollectionBase インスタンスに含まれる要素の一覧を取得します。

(継承元 ReadOnlyCollectionBase)
Item[Int32]

指定したインデックス位置にある ConfigurationLocationCollection オブジェクトを取得します。

メソッド

名前 説明
Equals(Object)

指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetEnumerator()

ReadOnlyCollectionBase インスタンスを反復処理する列挙子を返します。

(継承元 ReadOnlyCollectionBase)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

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

(継承元 Object)
MemberwiseClone()

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

(継承元 Object)
ToString()

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

(継承元 Object)

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

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

ターゲット配列の指定したインデックスから始まる互換性のある 1 次元Arrayに、ReadOnlyCollectionBase全体をコピーします。

(継承元 ReadOnlyCollectionBase)
ICollection.IsSynchronized

ReadOnlyCollectionBase オブジェクトへのアクセスが同期されているかどうかを示す値を取得します (スレッド セーフ)。

(継承元 ReadOnlyCollectionBase)
ICollection.SyncRoot

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

(継承元 ReadOnlyCollectionBase)

拡張メソッド

名前 説明
AsParallel(IEnumerable)

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

AsQueryable(IEnumerable)

IEnumerableIQueryableに変換します。

Cast<TResult>(IEnumerable)

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

OfType<TResult>(IEnumerable)

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

適用対象