ProfileProviderCollection 类

定义

继承 ProfileProvider 抽象类的对象的集合。

public ref class ProfileProviderCollection sealed : System::Configuration::SettingsProviderCollection
public sealed class ProfileProviderCollection : System.Configuration.SettingsProviderCollection
type ProfileProviderCollection = class
    inherit SettingsProviderCollection
Public NotInheritable Class ProfileProviderCollection
Inherits SettingsProviderCollection
继承

示例

下面的代码示例列出了为应用程序及其各自的类型启用的提供程序。

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Web.Profile" %>
<%@ Import Namespace="System.Configuration.Provider" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>List Enabled Providers</title>
</head>
<body>

<%
foreach (ProviderBase p in ProfileManager.Providers)
  Response.Write(p.Name + ", " + p.GetType() + "<br />");
%>

</body>
</html>
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Web.Profile" %>
<%@ Import Namespace="System.Configuration.Provider" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>List Enabled Providers</title>
</head>
<body>

<%
For Each p As ProviderBase In ProfileManager.Providers
  Response.Write(p.Name & ", " & p.GetType().ToString() & "<br />")
Next
%>

</body>
</html>

注解

应用程序的配置文件提供程序通过类的属性ProfileManager公开为只读。ProfileProviderCollection Providers 可以按名称访问集合中的特定配置文件提供程序,并将其强制转换为特定提供程序类型,例如 SqlProfileProvider。 这样,便可以管理单个应用程序中多个数据存储中的用户配置文件属性。 它还允许访问不是抽象类成员的特定配置文件提供程序的成员 ProfileProvider

构造函数

ProfileProviderCollection()

创建一个新的空配置文件提供程序集合。

属性

Count

获取集合中提供程序的数目。

(继承自 ProviderCollection)
IsSynchronized

获取一个值,该值指示对集合的访问是否为同步的(线程安全)。

(继承自 ProviderCollection)
Item[String]

返回指定的提供程序名称所引用的配置文件提供程序。

SyncRoot

获取当前对象。

(继承自 ProviderCollection)

方法

Add(ProviderBase)

将一个配置文件提供程序添加到该集合中。

Clear()

从集合中移除所有项。

(继承自 ProviderCollection)
CopyTo(ProviderBase[], Int32)

从指定索引处开始,将集合中的内容复制到给定数组。

(继承自 ProviderCollection)
Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetEnumerator()

返回一个对象,该对象实现 IEnumerator 接口以循环访问集合。

(继承自 ProviderCollection)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
Remove(String)

从集合中移除提供程序。

(继承自 ProviderCollection)
SetReadOnly()

将集合设置为只读。

(继承自 ProviderCollection)
ToString()

返回表示当前对象的字符串。

(继承自 Object)

显式接口实现

ICollection.CopyTo(Array, Int32)

ProviderCollection 的元素复制到一个数组中从特定的数组索引开始的位置。

(继承自 ProviderCollection)

扩展方法

Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。

OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。

AsParallel(IEnumerable)

启用查询的并行化。

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryable

适用于

另请参阅