Config Helper
GetSectionNames Method
Example 



KellermanSoftware.ConfigHelper Namespace > IniReaderWriter Class : GetSectionNames Method
The path to the INI file
Get a list of the sections in an INI file. The global section will be returned as GLOBAL. See also GLOBAL_SECTION_NAME
No COM Interop is used
If the file does not exist, no sections will be returned.
Syntax
Public Function GetSectionNames( _
   ByVal filePath As String _
) As List(Of String)
Dim instance As IniReaderWriter
Dim filePath As String
Dim value As List(Of String)
 
value = instance.GetSectionNames(filePath)
public List<string> GetSectionNames( 
   string filePath
)
public:
List<String^>^ GetSectionNames( 
   String^ filePath
) 

Parameters

filePath
The path to the INI file

Return Value

A list of the section names
Exceptions
ExceptionDescription
Occurs when filePath is null
Example
//Trial Mode
IniReaderWriter iniReaderWriter = new IniReaderWriter();
 
//License Mode
//IniReaderWriter iniReaderWriter = new IniReaderWriter("place user name here", "place license key here");
 
iniReaderWriter.SaveSetting("MySection", "MySettingName", "MySettingValue", "MySettingsFile.ini");
 
List<string> results = iniReaderWriter.GetSectionNames("MySettingsFile.ini");
Console.WriteLine(results[0]);
'Trial Mode
Dim iniReaderWriter As New IniReaderWriter()
 
'License Mode
'Dim iniReaderWriter As New IniReaderWriter("place user name here", "place license key here")
 
iniReaderWriter.SaveSetting("MySection", "MySettingName", "MySettingValue", "MySettingsFile.ini")
 
Dim results As List(Of String) = iniReaderWriter.GetSectionNames("MySettingsFile.ini")
Console.WriteLine(results(0))
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

IniReaderWriter Class
IniReaderWriter Members