Aracılığıyla paylaş


ConfigurationLocationCollection Sınıf

Tanım

Bir nesne koleksiyonu ConfigurationLocationCollection içerir.

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

Örnekler

Aşağıdaki kod örneğinde, uygulamanın MySampleApp Web yapılandırması yüklenir ve bu yapılandırmada tanımlanan konumlar özelliği tarafından Locations döndürülen nesne üzerinden ConfigurationLocationCollection yinelenerek görüntülenir.

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

Açıklamalar

Konumuna özgü yapılandırma ayarlarının ConfigurationLocationCollection tanımlandığı kaynakları temsil eden bir nesne koleksiyonunda ConfigurationLocation yineleme yapmak için sınıfını kullanın. ConfigurationLocationCollection özelliği tarafından Locations döndürülen türdür.

Uyarı

sınıfı, ConfigurationLocationCollection yapılandırma dosyasında belirtilen sırayla nesne koleksiyonuna ConfigurationLocation başvuruda bulunamayabilir.

Özellikler

Name Description
Count

Örnekte bulunan ReadOnlyCollectionBase öğe sayısını alır.

(Devralındığı yer: ReadOnlyCollectionBase)
InnerList

Örnekte bulunan ReadOnlyCollectionBase öğelerin listesini alır.

(Devralındığı yer: ReadOnlyCollectionBase)
Item[Int32]

ConfigurationLocationCollection Nesneyi belirtilen dizinde alır.

Yöntemler

Name Description
Equals(Object)

Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler.

(Devralındığı yer: Object)
GetEnumerator()

Örnekte yineleyen ReadOnlyCollectionBase bir numaralandırıcı döndürür.

(Devralındığı yer: ReadOnlyCollectionBase)
GetHashCode()

Varsayılan karma işlevi işlevi görür.

(Devralındığı yer: Object)
GetType()

Geçerli örneğin Type alır.

(Devralındığı yer: Object)
MemberwiseClone()

Geçerli Objectbasit bir kopyasını oluşturur.

(Devralındığı yer: Object)
ToString()

Geçerli nesneyi temsil eden bir dize döndürür.

(Devralındığı yer: Object)

Belirtik Arabirim Kullanımları

Name Description
ICollection.CopyTo(Array, Int32)

Hedef dizinin belirtilen dizininden başlayarak tamamını ReadOnlyCollectionBase uyumlu bir tek boyutluya Arraykopyalar.

(Devralındığı yer: ReadOnlyCollectionBase)
ICollection.IsSynchronized

Bir nesneye erişimin eşitlenip eşitlenmediğini belirten bir ReadOnlyCollectionBase değer alır (iş parçacığı güvenli).

(Devralındığı yer: ReadOnlyCollectionBase)
ICollection.SyncRoot

Bir nesneye erişimi eşitlemek için kullanılabilecek bir ReadOnlyCollectionBase nesne alır.

(Devralındığı yer: ReadOnlyCollectionBase)

Uzantı Metotları

Name Description
AsParallel(IEnumerable)

Sorgunun paralelleştirilmesini etkinleştirir.

AsQueryable(IEnumerable)

bir IEnumerable öğesine IQueryabledönüştürür.

Cast<TResult>(IEnumerable)

öğesinin IEnumerable öğelerini belirtilen türe yazar.

OfType<TResult>(IEnumerable)

Belirtilen türe göre bir IEnumerable öğesinin öğelerini filtreler.

Şunlara uygulanır