語言

RootProfilePropertySettingsCollection 類別

定義

作為兩層命名 ProfilePropertySettingsCollection 階層集合的頂端。

public ref class RootProfilePropertySettingsCollection sealed : System::Web::Configuration::ProfilePropertySettingsCollection
[System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.ProfilePropertySettings))]
public sealed class RootProfilePropertySettingsCollection : System.Web.Configuration.ProfilePropertySettingsCollection
[<System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.ProfilePropertySettings))>]
type RootProfilePropertySettingsCollection = class
    inherit ProfilePropertySettingsCollection
Public NotInheritable Class RootProfilePropertySettingsCollection
Inherits ProfilePropertySettingsCollection
繼承
屬性

範例

以下程式碼範例說明如何將 RootProfilePropertySettingsCollection 型別作為 PropertySettings 類別的 ProfileSection 屬性使用。 此程式碼範例是本類別更大範例 ProfileSection 的一部分。


// Display all current root ProfilePropertySettings.
Console.WriteLine("Current Root ProfilePropertySettings:");
int rootPPSCtr = 0;
foreach (ProfilePropertySettings rootPPS in profileSection.PropertySettings)
{
    Console.WriteLine("  {0}: ProfilePropertySetting '{1}'", ++rootPPSCtr,
        rootPPS.Name);
}

// Get and modify a root ProfilePropertySettings object.
Console.WriteLine(
    "Display and modify 'LastReadDate' ProfilePropertySettings:");
ProfilePropertySettings profilePropertySettings =
    profileSection.PropertySettings["LastReadDate"];

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

// Set the ReadOnly property to true.
profilePropertySettings.ReadOnly = true;

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

// Set the AllowAnonymous property to true.
profilePropertySettings.AllowAnonymous = true;

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

// Set the SerializeAs property to SerializationMode.Binary.
profilePropertySettings.SerializeAs = SerializationMode.Binary;

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

// Set the Type property to "System.DateTime".
profilePropertySettings.Type = "System.DateTime";

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

// Set the DefaultValue property to "March 16, 2004".
profilePropertySettings.DefaultValue = "March 16, 2004";

// Get the current ProviderName property value.
Console.WriteLine(
    "Current ProviderName value: '{0}'", profilePropertySettings.Provider);

// Set the ProviderName property to "AspNetSqlRoleProvider".
profilePropertySettings.Provider = "AspNetSqlRoleProvider";

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

// Set the Name property to "LastAccessDate".
profilePropertySettings.Name = "LastAccessDate";

// Display all current ProfileGroupSettings.
Console.WriteLine("Current ProfileGroupSettings:");
int PGSCtr = 0;
foreach (ProfileGroupSettings propGroups in profileSection.PropertySettings.GroupSettings)
{
    Console.WriteLine("  {0}: ProfileGroupSetting '{1}'", ++PGSCtr,
        propGroups.Name);
    int PPSCtr = 0;
    foreach (ProfilePropertySettings props in propGroups.PropertySettings)
    {
        Console.WriteLine("    {0}: ProfilePropertySetting '{1}'", ++PPSCtr,
            props.Name);
    }
}

// Add a new group.
ProfileGroupSettings newPropGroup = new ProfileGroupSettings("Forum");
profileSection.PropertySettings.GroupSettings.Add(newPropGroup);

// Add a new PropertySettings to the group.
ProfilePropertySettings newProp = new ProfilePropertySettings("AvatarImage");
newProp.Type = "System.String, System.dll";
newPropGroup.PropertySettings.Add(newProp);

// Remove a PropertySettings from the group.
newPropGroup.PropertySettings.Remove("AvatarImage");
newPropGroup.PropertySettings.RemoveAt(0);

// Clear all PropertySettings from the group.
newPropGroup.PropertySettings.Clear();


' Display all current root ProfilePropertySettings.
Console.WriteLine("Current Root ProfilePropertySettings:")
Dim rootPPSCtr As Integer = 0
For Each rootPPS As ProfilePropertySettings In profileSection.PropertySettings
    Console.WriteLine("  {0}: ProfilePropertySetting '{1}'", ++rootPPSCtr, _
        rootPPS.Name)
Next

' Get and modify a root ProfilePropertySettings object.
Console.WriteLine( _
    "Display and modify 'LastReadDate' ProfilePropertySettings:")
Dim profilePropertySettings As ProfilePropertySettings = _
    profileSection.PropertySettings("LastReadDate")

' Get the current ReadOnly property value.
Console.WriteLine( _
    "Current ReadOnly value: '{0}'", profilePropertySettings.ReadOnly)

' Set the ReadOnly property to true.
profilePropertySettings.ReadOnly = true

' Get the current AllowAnonymous property value.
Console.WriteLine( _
    "Current AllowAnonymous value: '{0}'", profilePropertySettings.AllowAnonymous)

' Set the AllowAnonymous property to true.
profilePropertySettings.AllowAnonymous = true

' Get the current SerializeAs property value.
Console.WriteLine( _
    "Current SerializeAs value: '{0}'", profilePropertySettings.SerializeAs)

' Set the SerializeAs property to SerializationMode.Binary.
profilePropertySettings.SerializeAs = SerializationMode.Binary

' Get the current Type property value.
Console.WriteLine( _
    "Current Type value: '{0}'", profilePropertySettings.Type)

' Set the Type property to "System.DateTime".
profilePropertySettings.Type = "System.DateTime"

' Get the current DefaultValue property value.
Console.WriteLine( _
    "Current DefaultValue value: '{0}'", profilePropertySettings.DefaultValue)

' Set the DefaultValue property to "March 16, 2004".
profilePropertySettings.DefaultValue = "March 16, 2004"

' Get the current ProviderName property value.
            Console.WriteLine( _
                "Current ProviderName value: '{0}'", profilePropertySettings.Provider)

' Set the ProviderName property to "AspNetSqlRoleProvider".
            profilePropertySettings.Provider = "AspNetSqlRoleProvider"

' Get the current Name property value.
Console.WriteLine( _
    "Current Name value: '{0}'", profilePropertySettings.Name)

' Set the Name property to "LastAccessDate".
profilePropertySettings.Name = "LastAccessDate"

' Display all current ProfileGroupSettings.
Console.WriteLine("Current ProfileGroupSettings:")
Dim PGSCtr As Integer = 0
For Each propGroups As ProfileGroupSettings In profileSection.PropertySettings.GroupSettings
                    Console.WriteLine("  {0}: ProfileGroupSettings '{1}'", ++PGSCtr, _
        propGroups.Name)
    Dim PPSCtr As Integer = 0
    For Each props As ProfilePropertySettings In propGroups.PropertySettings
        Console.WriteLine("    {0}: ProfilePropertySetting '{1}'", ++PPSCtr, _
            props.Name)
    Next
Next

' Add a new group.
Dim newPropGroup As ProfileGroupSettings = new ProfileGroupSettings("Forum")
profileSection.PropertySettings.GroupSettings.Add(newPropGroup)

' Add a new PropertySettings to the group.
Dim newProp As ProfilePropertySettings = new ProfilePropertySettings("AvatarImage")
newProp.Type = "System.String, System.dll"
newPropGroup.PropertySettings.Add(newProp)

' Remove a PropertySettings from the group.
newPropGroup.PropertySettings.Remove("AvatarImage")
newPropGroup.PropertySettings.RemoveAt(0)

' Clear all PropertySettings from the group.
newPropGroup.PropertySettings.Clear()

備註

這個 RootProfilePropertySettingsCollection 類別既是根層 ProfilePropertySettingsCollection 集合,也是集合的 ProfileGroupSettingsCollection 容器。 這些集合允許你建立更多 ProfilePropertySettingsCollection 命名的群組,每個集合包含獨立的命名 ProfilePropertySettings 物件。 欲了解更多關於 ASP.NET 2.0 新增的設定檔功能,請參閱 ASP.NET 設定檔屬性。

屬性PropertySettings是一個RootProfilePropertySettingsCollection物件,包含設定檔該區段子節properties內定義profile的所有屬性。

建構函式

名稱 Description
RootProfilePropertySettingsCollection()

使用預設設定初始化該類別的新實例 RootProfilePropertySettingsCollection 。

屬性

名稱 Description
AddElementName

取得或設定在衍生類別中覆寫時,要與 ConfigurationElement 中加入作業產生關聯的 ConfigurationElementCollection 名稱。

(繼承來源 ConfigurationElementCollection)
AllKeys

回傳一個陣列,包含集合中所有 ProfileSection 物件的名稱。

(繼承來源 ProfilePropertySettingsCollection)
AllowClear

會得到一個值,表示該透明<元素是否>作為物件有效ProfilePropertySettings。

(繼承來源 ProfilePropertySettingsCollection)
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)
GroupSettings

得到 ProfileGroupSettingsCollection 包含一組 ProfileGroupSettings 物件的 。

HasContext

取得值,這個值表示 CurrentConfiguration 屬性是否 null。

(繼承來源 ConfigurationElement)
IsSynchronized

取得值,指出是否同步存取集合。

(繼承來源 ConfigurationElementCollection)
Item[ConfigurationProperty]

取得或設定這個組態項目的屬性或屬性。

(繼承來源 ConfigurationElement)
Item[Int32]

取得或設定 ProfilePropertySettings 物件在指定的索引位置。

(繼承來源 ProfilePropertySettingsCollection)
Item[String]

取得或設定 ProfilePropertySettings 指定名稱的物件。

(繼承來源 ProfilePropertySettingsCollection)
LockAllAttributesExcept

取得鎖定屬性的集合。

(繼承來源 ConfigurationElement)
LockAllElementsExcept

取得鎖定專案的集合。

(繼承來源 ConfigurationElement)
LockAttributes

取得鎖定屬性的集合。

(繼承來源 ConfigurationElement)
LockElements

取得鎖定專案的集合。

(繼承來源 ConfigurationElement)
LockItem

取得或設定值,指出專案是否已鎖定。

(繼承來源 ConfigurationElement)
Properties

取得一組組設定屬性。

(繼承來源 ProfilePropertySettingsCollection)
RemoveElementName

取得或設定在衍生類別中覆寫時,要與 ConfigurationElement 中移除作業產生關聯的 ConfigurationElementCollection 名稱。

(繼承來源 ConfigurationElementCollection)
SyncRoot

取得對象,這個物件用來同步處理對 ConfigurationElementCollection的存取。

(繼承來源 ConfigurationElementCollection)
ThrowOnDuplicate

會取得一個值,指示如果嘗試建立重複物件時是否應該拋出錯誤。

(繼承來源 ProfilePropertySettingsCollection)

方法

名稱 Description
Add(ProfilePropertySettings)

新增一個 ProfilePropertySettings 物件到集合中。

(繼承來源 ProfilePropertySettingsCollection)
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)

指出是否已從 ConfigurationElement中移除具有指定索引鍵的 ConfigurationElementCollection。

(繼承來源 ConfigurationElementCollection)
BaseRemove(Object)

從集合中移除 ConfigurationElement。

(繼承來源 ConfigurationElementCollection)
BaseRemoveAt(Int32)

拿掉位於指定索引位置的 ConfigurationElement。

(繼承來源 ConfigurationElementCollection)
Clear()

移除收藏中的所有 ProfilePropertySettings 物件。

(繼承來源 ProfilePropertySettingsCollection)
CopyTo(ConfigurationElement[], Int32)

將 ConfigurationElementCollection 的內容複製到陣列。

(繼承來源 ConfigurationElementCollection)
CreateNewElement()

在衍生類別中覆寫時,建立新的 ConfigurationElement。

(繼承來源 ProfilePropertySettingsCollection)
CreateNewElement(String)

在衍生類別中覆寫時,建立新的 ConfigurationElement。

(繼承來源 ConfigurationElementCollection)
DeserializeElement(XmlReader, Boolean)

從組態檔讀取 XML。

(繼承來源 ConfigurationElement)
Equals(Object)

將當前 RootProfilePropertySettingsCollection 物件與另一個 A RootProfilePropertySettingsCollection 物件比較。

Get(Int32)

回傳 ProfileSection 指定的索引物件。

(繼承來源 ProfilePropertySettingsCollection)
Get(String)

回傳 ProfileSection 指定名稱的物件。

(繼承來源 ProfilePropertySettingsCollection)
GetElementKey(ConfigurationElement)

取得指定配置元素的金鑰。

(繼承來源 ProfilePropertySettingsCollection)
GetEnumerator()

得到IEnumerator一個 ,用於迭代 。ConfigurationElementCollection

(繼承來源 ConfigurationElementCollection)
GetHashCode()

為集合產生雜湊碼。

GetKey(Int32)

在指定的索引位置取得 的 ProfilePropertySettings 名稱。

(繼承來源 ProfilePropertySettingsCollection)
GetTransformedAssemblyString(String)

傳回所指定元件名稱的轉換版本。

(繼承來源 ConfigurationElement)
GetTransformedTypeString(String)

傳回指定之型別名稱的轉換版本。

(繼承來源 ConfigurationElement)
GetType()

取得目前實例的 Type。

(繼承來源 Object)
IndexOf(ProfilePropertySettings)

回傳指定 ProfilePropertySettings 物件的索引。

(繼承來源 ProfilePropertySettingsCollection)
Init()

將 ConfigurationElement 物件設定為其初始狀態。

(繼承來源 ConfigurationElement)
InitializeDefault()

用來初始化 ConfigurationElement 物件的預設值集。

(繼承來源 ConfigurationElement)
IsElementName(String)

指出指定的 ConfigurationElement 是否存在於 ConfigurationElementCollection中。

(繼承來源 ConfigurationElementCollection)
IsElementRemovable(ConfigurationElement)

指出是否可以從 ConfigurationElement中移除指定的 ConfigurationElementCollection。

(繼承來源 ConfigurationElementCollection)
IsModified()

指出此 ConfigurationElementCollection 自上次儲存或載入衍生類別時是否已修改。

(繼承來源 ConfigurationElementCollection)
IsReadOnly()

指出 ConfigurationElementCollection 物件是否為唯讀。

(繼承來源 ConfigurationElementCollection)
ListErrors(IList)

將這個 ConfigurationElement 物件和所有子元素中的無效屬性錯誤新增至傳遞的清單。

(繼承來源 ConfigurationElement)
MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
OnDeserializeUnrecognizedAttribute(String, String)

取得值,指出還原串行化期間是否遇到未知的屬性。

(繼承來源 ConfigurationElement)
OnDeserializeUnrecognizedElement(String, XmlReader)

處理從設定檔讀取未識別的設定元素,若無法處理該元素,則會讓設定系統拋出例外。

(繼承來源 ProfilePropertySettingsCollection)
OnRequiredPropertyNotFound(String)

找不到必要屬性時擲回例外狀況。

(繼承來源 ConfigurationElement)
PostDeserialize()

在還原串行化之後呼叫。

(繼承來源 ConfigurationElement)
PreSerialize(XmlWriter)

在串行化之前呼叫。

(繼承來源 ConfigurationElement)
Remove(String)

從集合中移除一個 ProfilePropertySettings 物件。

(繼承來源 ProfilePropertySettingsCollection)
RemoveAt(Int32)

從集合中移除指定索引位置的 ProfilePropertySettings 物件。

(繼承來源 ProfilePropertySettingsCollection)
Reset(ConfigurationElement)

在衍生類別中覆寫時,將 ConfigurationElementCollection 重設為其未修改的狀態。

(繼承來源 ConfigurationElementCollection)
ResetModified()

在衍生類別中覆寫時,將 IsModified() 屬性的值重設為 false。

(繼承來源 ConfigurationElementCollection)
SerializeElement(XmlWriter, Boolean)

在衍生類別中覆寫時,將組態數據寫入組態檔中的 XML 專案。

(繼承來源 ConfigurationElementCollection)
SerializeToXmlElement(XmlWriter, String)

在衍生類別中實作時,將此組態專案的外部標記寫入組態檔。

(繼承來源 ConfigurationElement)
Set(ProfilePropertySettings)

將指定的 ProfilePropertySettings 物件加入集合中。

(繼承來源 ProfilePropertySettingsCollection)
SetPropertyValue(ConfigurationProperty, Object, Boolean)

將屬性設定為指定的值。

(繼承來源 ConfigurationElement)
SetReadOnly()

設定 IsReadOnly() 物件和所有子元素的 ConfigurationElementCollection 屬性。

(繼承來源 ConfigurationElementCollection)
ToString()

傳回表示目前 物件的字串。

(繼承來源 Object)
Unmerge(ConfigurationElement, ConfigurationElement, ConfigurationSaveMode)

反轉從不同組態階層層級合併組態資訊的效果。

(繼承來源 ConfigurationElementCollection)

明確介面實作

名稱 Description
ICollection.CopyTo(Array, Int32)

將 ConfigurationElementCollection 複製到陣列。

(繼承來源 ConfigurationElementCollection)

擴充方法

名稱 Description
AsParallel(IEnumerable)

啟用查詢的平行處理。

AsQueryable(IEnumerable)

將 IEnumerable 轉換成 IQueryable。

Cast<TResult>(IEnumerable)

將 IEnumerable 的項目轉換成指定的型別。

OfType<TResult>(IEnumerable)

根據指定的型別篩選 IEnumerable 的專案。

適用於

另請參閱