Config Helper
GetSectionValues Method
Example 



KellermanSoftware.ConfigHelper Namespace > IniReaderWriter Class : GetSectionValues Method
The section name. Use GLOBAL for the global section.
The path to the INI file
Get a dictionary of the key value pairs for a section in an INI file
No COM Interop is used
If the file does not exist, no items will be returned.
Syntax
Public Function GetSectionValues( _
   ByVal sectionName As String, _
   ByVal filePath As String _
) As Dictionary(Of String,String)
Dim instance As IniReaderWriter
Dim sectionName As String
Dim filePath As String
Dim value As Dictionary(Of String,String)
 
value = instance.GetSectionValues(sectionName, filePath)
public Dictionary<string,string> GetSectionValues( 
   string sectionName,
   string filePath
)
public:
Dictionary<String^,String^>^ GetSectionValues( 
   String^ sectionName,
   String^ filePath
) 

Parameters

sectionName
The section name. Use GLOBAL for the global section.
filePath
The path to the INI file

Return Value

A list of the settings and their values
Exceptions
ExceptionDescription
Occurs when sectionName, or 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", "MySettingName1", "MySettingValue1", "MySettingsFile.ini");
iniReaderWriter.SaveSetting("MySection", "MySettingName2", "MySettingValue2", "MySettingsFile.ini");
 
Dictionary<string, string> results = iniReaderWriter.GetSectionValues("MySection", "MySettingsFile.ini");
 
Console.WriteLine(results["MySettingName1"]);
Console.WriteLine(results["MySettingName2"]);
'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", "MySettingName1", "MySettingValue1", "MySettingsFile.ini")
iniReaderWriter.SaveSetting("MySection", "MySettingName2", "MySettingValue2", "MySettingsFile.ini")
 
Dim results As Dictionary(Of String, String) = iniReaderWriter.GetSectionValues("MySection", "MySettingsFile.ini")
 
Console.WriteLine(results("MySettingName1"))
Console.WriteLine(results("MySettingName2"))
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