ConfigurationLocationCollection 类  
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
包含 ConfigurationLocationCollection 对象的集合。
public ref class ConfigurationLocationCollection : System::Collections::ReadOnlyCollectionBase
	public class ConfigurationLocationCollection : System.Collections.ReadOnlyCollectionBase
	type ConfigurationLocationCollection = class
    inherit ReadOnlyCollectionBase
	Public Class ConfigurationLocationCollection
Inherits ReadOnlyCollectionBase
		- 继承
 
示例
在以下代码示例中,加载应用程序的 MySampleApp Web 配置,并通过循环访问 ConfigurationLocationCollection 属性返回 Locations 的对象来显示此配置中定义的位置。
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) | 
		 从目标数组的指定索引处开始将整个 ReadOnlyCollectionBase 复制到兼容的一维 Array。 (继承自 ReadOnlyCollectionBase) | 
        	
| ICollection.IsSynchronized | 
		 获取一个值,该值指示对 ReadOnlyCollectionBase 对象的访问是否同步(线程安全)。 (继承自 ReadOnlyCollectionBase) | 
        	
| ICollection.SyncRoot | 
		 获取一个对象,该对象可用于同步对 ReadOnlyCollectionBase 对象的访问。 (继承自 ReadOnlyCollectionBase) | 
        	
扩展方法
| Cast<TResult>(IEnumerable) | 
		 将 IEnumerable 的元素强制转换为指定的类型。  | 
        	
| OfType<TResult>(IEnumerable) | 
		 根据指定类型筛选 IEnumerable 的元素。  | 
        	
| AsParallel(IEnumerable) | 
		 启用查询的并行化。  | 
        	
| AsQueryable(IEnumerable) | 
		 将 IEnumerable 转换为 IQueryable。  |