ConfigurationSectionGroupCollection.Get Methode
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee haalt u een ConfigurationSectionGroup object op uit de verzameling.
Overloads
| Name | Description |
|---|---|
| Get(Int32) |
Hiermee haalt u het opgegeven ConfigurationSectionGroup object op dat is opgenomen in de verzameling. |
| Get(String) |
Hiermee haalt u het opgegeven ConfigurationSectionGroup object op uit de verzameling. |
Opmerkingen
Deze methode is een wrapper rond de BaseGet methode.
Get(Int32)
Hiermee haalt u het opgegeven ConfigurationSectionGroup object op dat is opgenomen in de verzameling.
public:
System::Configuration::ConfigurationSectionGroup ^ Get(int index);
public System.Configuration.ConfigurationSectionGroup Get(int index);
member this.Get : int -> System.Configuration.ConfigurationSectionGroup
Public Function Get (index As Integer) As ConfigurationSectionGroup
Parameters
- index
- Int32
De index van het ConfigurationSectionGroup object dat moet worden geretourneerd.
Retouren
Het ConfigurationSectionGroup object op de opgegeven index.
Opmerkingen
Deze methode is een wrapper rond de BaseGet methode.
Van toepassing op
Get(String)
Hiermee haalt u het opgegeven ConfigurationSectionGroup object op uit de verzameling.
public:
System::Configuration::ConfigurationSectionGroup ^ Get(System::String ^ name);
public System.Configuration.ConfigurationSectionGroup Get(string name);
member this.Get : string -> System.Configuration.ConfigurationSectionGroup
Public Function Get (name As String) As ConfigurationSectionGroup
Parameters
- name
- String
De naam van het ConfigurationSectionGroup object dat moet worden geretourneerd.
Retouren
Het ConfigurationSectionGroup object met de opgegeven naam.
Uitzonderingen
name is null of een lege tekenreeks ("").
Voorbeelden
In het volgende codevoorbeeld ziet u hoe u de Get methode gebruikt.
static void GetGroup()
{
try
{
System.Configuration.Configuration config =
ConfigurationManager.OpenExeConfiguration(
ConfigurationUserLevel.None);
ConfigurationSectionGroup customGroup =
config.SectionGroups.Get("CustomGroup");
if (customGroup == null)
Console.WriteLine(
"Failed to load CustomSection.");
else
{
// Display section information
Console.WriteLine("Section group name: {0}",
customGroup.SectionGroupName);
Console.WriteLine("Name: {0}",
customGroup.Name);
Console.WriteLine("Type: {0}",
customGroup.Type);
}
}
catch (ConfigurationErrorsException err)
{
Console.WriteLine(err.ToString());
}
}
Shared Sub GetGroup()
Try
Dim config _
As System.Configuration.Configuration = _
ConfigurationManager.OpenExeConfiguration( _
ConfigurationUserLevel.None)
Dim groups _
As ConfigurationSectionGroupCollection = _
config.SectionGroups
Dim customGroup _
As ConfigurationSectionGroup = _
groups.Get("CustomGroup")
If customGroup Is Nothing Then
Console.WriteLine( _
"Failed to load CustomGroup.")
Else
' Display section information
Console.WriteLine("Name: {0}", _
customGroup.Name)
Console.WriteLine("Type: {0}", _
customGroup.Type)
End If
Catch err As ConfigurationErrorsException
Console.WriteLine(err.ToString())
End Try
End Sub
Opmerkingen
Deze methode is een wrapper rond de BaseGet methode.