ProfileSettingsCollection Classe
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Contém uma coleção de ProfileSettings objetos. Esta classe não pode ser herdada.
public ref class ProfileSettingsCollection sealed : System::Configuration::ConfigurationElementCollection
[System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.ProfileSettings))]
public sealed class ProfileSettingsCollection : System.Configuration.ConfigurationElementCollection
[<System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.ProfileSettings))>]
type ProfileSettingsCollection = class
inherit ConfigurationElementCollection
Public NotInheritable Class ProfileSettingsCollection
Inherits ConfigurationElementCollection
- Herança
- Atributos
Exemplos
O seguinte exemplo de código mostra como usar o ProfileSettingsCollection tipo. Este exemplo de código faz parte de um exemplo maior fornecido para a HealthMonitoringSection classe.
// Add a ProfileSettings object to the Profiles collection property.
ProfileSettings profileSetting = new ProfileSettings("Default");
profileSetting.Name = "Custom";
profileSetting.MaxLimit = Int32.MaxValue;
profileSetting.MinInstances = 1;
profileSetting.MinInterval = TimeSpan.Parse("00:01:00");
profileSetting.Custom = "MyEvaluators.MyCustomeEvaluator, MyCustom.dll";
healthMonitoringSection.Profiles.Add(profileSetting);
// Add a ProfileSettings object to the Profiles collection property.
healthMonitoringSection.Profiles.Add(new ProfileSettings("Default"));
// Add a ProfileSettings object to the Profiles collection property.
healthMonitoringSection.Profiles.Add(new ProfileSettings("Critical",
1, 1024, new TimeSpan(0, 0, 00)));
// Add a ProfileSettings object to the Profiles collection property.
healthMonitoringSection.Profiles.Add(new ProfileSettings("Targeted",
1, Int32.MaxValue, new TimeSpan(0, 0, 10),
"MyEvaluators.MyTargetedEvaluator, MyCustom.dll"));
// Insert an ProfileSettings object into the Profiles collection property.
healthMonitoringSection.Profiles.Insert(1, new ProfileSettings("Default2"));
// Display contents of the Profiles collection property
Console.WriteLine(
"Profiles Collection contains {0} values:",
healthMonitoringSection.Profiles.Count);
// Display all elements.
for (System.Int32 i = 0; i < healthMonitoringSection.Profiles.Count; i++)
{
profileSetting = healthMonitoringSection.Profiles[i];
string name = profileSetting.Name;
int minInstances = profileSetting.MinInstances;
int maxLimit = profileSetting.MaxLimit;
TimeSpan minInterval = profileSetting.MinInterval;
string custom = profileSetting.Custom;
string item = "Name='" + name +
"', MinInstances = '" + minInstances + "', MaxLimit = '" + maxLimit +
"', MinInterval = '" + minInterval + "', Custom = '" + custom + "'";
Console.WriteLine(" Item {0}: {1}", i, item);
}
// See if the ProfileSettings collection property contains the event 'Default'.
Console.WriteLine("Profiles contains 'Default': {0}.",
healthMonitoringSection.Profiles.Contains("Default"));
// Get the index of the 'Default' ProfileSettings in the Profiles collection property.
Console.WriteLine("Profiles index for 'Default': {0}.",
healthMonitoringSection.Profiles.IndexOf("Default"));
// Get a named ProfileSettings
profileSetting = healthMonitoringSection.Profiles["Default"];
// Remove a ProfileSettings object from the Profiles collection property.
healthMonitoringSection.Profiles.Remove("Default");
// Remove a ProfileSettings object from the Profiles collection property.
healthMonitoringSection.Profiles.RemoveAt(0);
// Clear all ProfileSettings object from the Profiles collection property.
healthMonitoringSection.Profiles.Clear();
' Add a ProfileSettings object to the Profiles collection property.
Dim profileSetting As ProfileSettings = New ProfileSettings("Default")
profileSetting.Name = "Custom"
profileSetting.MaxLimit = Int32.MaxValue
profileSetting.MinInstances = 1
profileSetting.MinInterval = TimeSpan.Parse("00:01:00")
profileSetting.Custom = "MyEvaluators.MyCustomeEvaluator, MyCustom.dll"
healthMonitoringSection.Profiles.Add(profileSetting)
' Add a ProfileSettings object to the Profiles collection property.
healthMonitoringSection.Profiles.Add(new ProfileSettings("Default"))
' Add a ProfileSettings object to the Profiles collection property.
healthMonitoringSection.Profiles.Add(new ProfileSettings("Critical", _
1, 1024, new TimeSpan(0, 0, 00)))
' Add a ProfileSettings object to the Profiles collection property.
healthMonitoringSection.Profiles.Add(new ProfileSettings("Targeted", _
1, Int32.MaxValue, new TimeSpan(0, 0, 10), _
"MyEvaluators.MyTargetedEvaluator, MyCustom.dll"))
' Insert an ProfileSettings object into the Profiles collection property.
healthMonitoringSection.Profiles.Insert(1, new ProfileSettings("Default2"))
' Display contents of the Profiles collection property
Console.WriteLine( _
"Profiles Collection contains {0} values:", _
healthMonitoringSection.Profiles.Count)
' Display all elements.
For i As System.Int32 = 0 To healthMonitoringSection.Profiles.Count - 1
profileSetting = healthMonitoringSection.Profiles(i)
Dim name As String = profileSetting.Name
Dim minInstances As Integer = profileSetting.MinInstances
Dim maxLimit As Integer = profileSetting.MaxLimit
Dim minInterval As TimeSpan = profileSetting.MinInterval
Dim custom As String = profileSetting.Custom
Dim item As String = "Name='" & name & _
"', MinInstances = '" & minInstances & "', MaxLimit = '" & maxLimit & _
"', MinInterval = '" & minInterval.ToString() & "', Custom = '" & custom & "'"
Console.WriteLine(" Item {0}: {1}", i, item)
Next
' See if the ProfileSettings collection property contains the event 'Default'.
Console.WriteLine("Profiles contains 'Default': {0}.", _
healthMonitoringSection.Profiles.Contains("Default"))
' Get the index of the 'Default' ProfileSettings in the Profiles collection property.
Console.WriteLine("Profiles index for 'Default': {0}.", _
healthMonitoringSection.Profiles.IndexOf("Default"))
' Get a named ProfileSettings
profileSetting = healthMonitoringSection.Profiles("Default")
' Remove a ProfileSettings object from the Profiles collection property.
healthMonitoringSection.Profiles.Remove("Default")
' Remove a ProfileSettings object from the Profiles collection property.
healthMonitoringSection.Profiles.RemoveAt(0)
' Clear all ProfileSettings object from the Profiles collection property.
healthMonitoringSection.Profiles.Clear()
Observações
ProfileSettings Os objetos são usados para definir perfis de eventos.
Construtores
| Name | Description |
|---|---|
| ProfileSettingsCollection() |
Inicializa uma nova instância da ProfileSettingsCollection classe. |
Propriedades
| Name | Description |
|---|---|
| AddElementName |
Obtém ou define o nome do ConfigurationElement para associar à operação de adição em quando ConfigurationElementCollection são sobrepostos numa classe derivada. (Herdado de ConfigurationElementCollection) |
| ClearElementName |
Obtém ou define o nome para o ConfigurationElement associar à operação clear em quando ConfigurationElementCollection são sobrepostos numa classe derivada. (Herdado de ConfigurationElementCollection) |
| CollectionType |
Obtém o tipo do ConfigurationElementCollection. (Herdado de ConfigurationElementCollection) |
| Count |
Obtém o número de elementos na coleção. (Herdado de ConfigurationElementCollection) |
| CurrentConfiguration |
Obtém uma referência à instância de topo Configuration que representa a hierarquia de configuração a que pertence a instância atual ConfigurationElement . (Herdado de ConfigurationElement) |
| ElementInformation |
Obtém um ElementInformation objeto que contém a informação e funcionalidade não personalizáveis do ConfigurationElement objeto. (Herdado de ConfigurationElement) |
| ElementName |
Recebe o nome usado para identificar esta coleção de elementos no ficheiro de configuração quando sobreposta numa classe derivada. (Herdado de ConfigurationElementCollection) |
| ElementProperty |
Obtém o ConfigurationElementProperty objeto que representa o ConfigurationElement próprio objeto. (Herdado de ConfigurationElement) |
| EmitClear |
Recebe ou define um valor que especifica se a coleção foi limpa. (Herdado de ConfigurationElementCollection) |
| EvaluationContext |
Obtém o ContextInformation objeto para o ConfigurationElement objeto. (Herdado de ConfigurationElement) |
| HasContext |
Obtém um valor que indica se a CurrentConfiguration propriedade é |
| IsSynchronized |
Recebe um valor que indica se o acesso à coleção está sincronizado. (Herdado de ConfigurationElementCollection) |
| Item[ConfigurationProperty] |
Obtém ou define uma propriedade ou atributo deste elemento de configuração. (Herdado de ConfigurationElement) |
| Item[Int32] |
Obtém ou define o ProfileSettings objeto no índice numérico especificado na coleção. |
| Item[String] |
Obtém o ProfileSettings objeto com base na chave especificada na coleção. |
| LockAllAttributesExcept |
Obtém a coleção de atributos bloqueados. (Herdado de ConfigurationElement) |
| LockAllElementsExcept |
Obtém a coleção de elementos bloqueados. (Herdado de ConfigurationElement) |
| LockAttributes |
Obtém a coleção de atributos bloqueados. (Herdado de ConfigurationElement) |
| LockElements |
Obtém a coleção de elementos bloqueados. (Herdado de ConfigurationElement) |
| LockItem |
Recebe ou define um valor que indica se o elemento está bloqueado. (Herdado de ConfigurationElement) |
| Properties |
Recebe a coleção de propriedades. (Herdado de ConfigurationElement) |
| RemoveElementName |
Obtém ou define o nome do ConfigurationElement para associar à operação de remoção em quando ConfigurationElementCollection sobrescrito numa classe derivada. (Herdado de ConfigurationElementCollection) |
| SyncRoot |
Obtém um objeto usado para sincronizar o acesso ao ConfigurationElementCollection. (Herdado de ConfigurationElementCollection) |
| ThrowOnDuplicate |
Obtém um valor que indica se uma tentativa de adicionar um duplicado ConfigurationElement a ConfigurationElementCollection fará com que seja lançada uma exceção. (Herdado de ConfigurationElementCollection) |
Métodos
| Name | Description |
|---|---|
| Add(ProfileSettings) |
Adiciona um ProfileSettings objeto à coleção. |
| BaseAdd(ConfigurationElement, Boolean) |
Adiciona um elemento de configuração à coleção de elementos de configuração. (Herdado de ConfigurationElementCollection) |
| BaseAdd(ConfigurationElement) |
Adiciona um elemento de configuração ao ConfigurationElementCollection. (Herdado de ConfigurationElementCollection) |
| BaseAdd(Int32, ConfigurationElement) |
Adiciona um elemento de configuração à coleção de elementos de configuração. (Herdado de ConfigurationElementCollection) |
| BaseClear() |
Remove todos os objetos elemento de configuração da coleção. (Herdado de ConfigurationElementCollection) |
| BaseGet(Int32) |
Obtém o elemento de configuração na localização do índice especificada. (Herdado de ConfigurationElementCollection) |
| BaseGet(Object) |
Devolve o elemento de configuração com a chave especificada. (Herdado de ConfigurationElementCollection) |
| BaseGetAllKeys() |
Devolve um array das chaves para todos os elementos de configuração contidos no ConfigurationElementCollection. (Herdado de ConfigurationElementCollection) |
| BaseGetKey(Int32) |
Obtém a chave para o ConfigurationElement na localização do índice especificada. (Herdado de ConfigurationElementCollection) |
| BaseIndexOf(ConfigurationElement) |
Indica o índice do especificado ConfigurationElement. (Herdado de ConfigurationElementCollection) |
| BaseIsRemoved(Object) |
Indica se o ConfigurationElement com a chave especificada foi removido do ConfigurationElementCollection. (Herdado de ConfigurationElementCollection) |
| BaseRemove(Object) |
Remove a ConfigurationElement da coleção. (Herdado de ConfigurationElementCollection) |
| BaseRemoveAt(Int32) |
Remove o ConfigurationElement na localização do índice especificada. (Herdado de ConfigurationElementCollection) |
| Clear() |
Remove todos ProfileSettings os objetos da coleção. |
| Contains(String) |
Indica se a coleção contém um ProfileSettings objeto com o nome especificado. |
| CopyTo(ConfigurationElement[], Int32) |
Copia o conteúdo do ConfigurationElementCollection para um array. (Herdado de ConfigurationElementCollection) |
| CreateNewElement() |
Quando sobreposto numa classe derivada, cria-se um novo ConfigurationElement. (Herdado de ConfigurationElementCollection) |
| CreateNewElement(String) |
Cria um novo ConfigurationElement quando é sobreposto numa classe derivada. (Herdado de ConfigurationElementCollection) |
| DeserializeElement(XmlReader, Boolean) |
Lê XML a partir do ficheiro de configuração. (Herdado de ConfigurationElement) |
| Equals(Object) |
Compara o ConfigurationElementCollection com o objeto especificado. (Herdado de ConfigurationElementCollection) |
| GetElementKey(ConfigurationElement) |
Obtém a chave de elemento para um elemento de configuração especificado quando sobrescrito numa classe derivada. (Herdado de ConfigurationElementCollection) |
| GetEnumerator() |
Obtém um IEnumerator que é usado para iterar através do ConfigurationElementCollection. (Herdado de ConfigurationElementCollection) |
| GetHashCode() |
Obtém um valor único que representa a ConfigurationElementCollection instância. (Herdado de ConfigurationElementCollection) |
| GetTransformedAssemblyString(String) |
Devolve a versão transformada do nome da assembleia especificado. (Herdado de ConfigurationElement) |
| GetTransformedTypeString(String) |
Devolve a versão transformada do nome do tipo especificado. (Herdado de ConfigurationElement) |
| GetType() |
Obtém o Type da instância atual. (Herdado de Object) |
| IndexOf(String) |
Devolve o índice do objeto especificado ProfileSettings . |
| Init() |
Define o ConfigurationElement objeto para o seu estado inicial. (Herdado de ConfigurationElement) |
| InitializeDefault() |
Usado para inicializar um conjunto padrão de valores para o ConfigurationElement objeto. (Herdado de ConfigurationElement) |
| Insert(Int32, ProfileSettings) |
Insere o objeto especificado ProfileSettings no índice especificado na coleção. |
| IsElementName(String) |
Indica se o especificado ConfigurationElement existe no ConfigurationElementCollection. (Herdado de ConfigurationElementCollection) |
| IsElementRemovable(ConfigurationElement) |
Indica se o especificado ConfigurationElement pode ser removido do ConfigurationElementCollection. (Herdado de ConfigurationElementCollection) |
| IsModified() |
Indica se isto ConfigurationElementCollection foi modificado desde a última vez que foi guardado ou carregado quando sobrescrito numa classe derivada. (Herdado de ConfigurationElementCollection) |
| IsReadOnly() |
Indica se o ConfigurationElementCollection objeto é apenas leitura. (Herdado de ConfigurationElementCollection) |
| ListErrors(IList) |
Adiciona os erros de propriedades inválidas neste ConfigurationElement objeto, e em todos os subelementos, à lista passada. (Herdado de ConfigurationElement) |
| MemberwiseClone() |
Cria uma cópia superficial do atual Object. (Herdado de Object) |
| OnDeserializeUnrecognizedAttribute(String, String) |
Recebe um valor que indica se um atributo desconhecido é encontrado durante a desserialização. (Herdado de ConfigurationElement) |
| OnDeserializeUnrecognizedElement(String, XmlReader) |
Faz com que o sistema de configuração lance uma exceção. (Herdado de ConfigurationElementCollection) |
| OnRequiredPropertyNotFound(String) |
Lança uma exceção quando uma propriedade exigida não é encontrada. (Herdado de ConfigurationElement) |
| PostDeserialize() |
Chamada após desserialização. (Herdado de ConfigurationElement) |
| PreSerialize(XmlWriter) |
Chamado antes da serialização. (Herdado de ConfigurationElement) |
| Remove(String) |
Remove um BufferModeSettings objeto da coleção. |
| RemoveAt(Int32) |
Remove um ProfileSettings objeto na localização de índice especificada da coleção. |
| Reset(ConfigurationElement) |
Reinicia o ConfigurationElementCollection para o seu estado não modificado quando sobreposto numa classe derivada. (Herdado de ConfigurationElementCollection) |
| ResetModified() |
Redefine o valor da IsModified() propriedade para |
| SerializeElement(XmlWriter, Boolean) |
Escreve os dados de configuração num elemento XML no ficheiro de configuração quando sobreposto numa classe derivada. (Herdado de ConfigurationElementCollection) |
| SerializeToXmlElement(XmlWriter, String) |
Escreve as etiquetas exteriores deste elemento de configuração no ficheiro de configuração quando implementado numa classe derivada. (Herdado de ConfigurationElement) |
| SetPropertyValue(ConfigurationProperty, Object, Boolean) |
Define uma propriedade para o valor especificado. (Herdado de ConfigurationElement) |
| SetReadOnly() |
Define a IsReadOnly() propriedade para o ConfigurationElementCollection objeto e para todos os subelementos. (Herdado de ConfigurationElementCollection) |
| ToString() |
Devolve uma cadeia que representa o objeto atual. (Herdado de Object) |
| Unmerge(ConfigurationElement, ConfigurationElement, ConfigurationSaveMode) |
Inverte o efeito da fusão de informação de configuração de diferentes níveis da hierarquia de configuração. (Herdado de ConfigurationElementCollection) |
Implementações de Interface Explícita
| Name | Description |
|---|---|
| ICollection.CopyTo(Array, Int32) |
Copia para ConfigurationElementCollection um array. (Herdado de ConfigurationElementCollection) |
Métodos da Extensão
| Name | Description |
|---|---|
| AsParallel(IEnumerable) |
Permite a paralelização de uma consulta. |
| AsQueryable(IEnumerable) |
Converte um IEnumerable para um IQueryable. |
| Cast<TResult>(IEnumerable) |
Conjura os elementos de an IEnumerable para o tipo especificado. |
| OfType<TResult>(IEnumerable) |
Filtra os elementos de um IEnumerable com base num tipo especificado. |