Config Helper
CommentCharacter Property
Example 



KellermanSoftware.ConfigHelper Namespace > IniReaderWriter Class : CommentCharacter Property
The comment character. By default it is a semicolon
Syntax
Public Property CommentCharacter As String
Dim instance As IniReaderWriter
Dim value As String
 
instance.CommentCharacter = value
 
value = instance.CommentCharacter
public string CommentCharacter {get; set;}
public:
property String^ CommentCharacter {
   String^ get();
   void set (    String^ value);
}
Example
//Trial Mode
IniReaderWriter iniReaderWriter = new IniReaderWriter();
 
//License Mode
//IniReaderWriter iniReaderWriter = new IniReaderWriter("place user name here", "place license key here"); 
 
//Change the comment character from a semi colon to a pound sign
iniReaderWriter.CommentCharacter = "#";
 
string text = @"#This is a comment
[MySection]
MySettingName=MySettingValue";
 
File.WriteAllText("MySettingsFile.ini",text);
 
string actualValue = iniReaderWriter.GetSetting("MySection", "MySettingName", "MySettingsFile.ini");
Console.WriteLine(actualValue);
'Trial Mode
Dim iniReaderWriter As New IniReaderWriter()
 
'License Mode
'Dim iniReaderWriter As New IniReaderWriter("place user name here", "place license key here")
 
'Change the comment character from a semi colon to a pound sign
iniReaderWriter.CommentCharacter = "#"
 
Dim text As String = "#This is a comment" & ControlChars.CrLf & "[MySection]" & ControlChars.CrLf & "MySettingName=MySettingValue"
 
File.WriteAllText("MySettingsFile.ini",text)
 
Dim actualValue As String = iniReaderWriter.GetSetting("MySection", "MySettingName", "MySettingsFile.ini")
Console.WriteLine(actualValue)
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