共用方式為


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物件,包含設定檔該區段子節profile內定義properties的所有屬性。

建構函式

名稱 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)

從集合中移除 a 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 到 array。

(繼承來源 ConfigurationElementCollection)

擴充方法

名稱 Description
AsParallel(IEnumerable)

啟用查詢的平行處理。

AsQueryable(IEnumerable)

IEnumerable 轉換成 IQueryable

Cast<TResult>(IEnumerable)

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

OfType<TResult>(IEnumerable)

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

適用於

另請參閱