Thus if the config file is like:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
   <configSections>
      <!-- Extra custom configuration sections -->
      <section name="monitoredPrinters"            type="PrinterMonitorService.CustomConfigurationSectionReaders.MonitoredPrintersSectionReader, PrinterMonitorService" />         
   </configSections>
       
    <monitoredPrinters>
         <!-- DeviceName = The unique name by which the printer is known
           -->
         <monitoredPrinter DeviceName="HP LaserJet 5L"/>
         <monitoredPrinter DeviceName="Microsoft Office Document Image Writer"/>
    </monitoredPrinters>
      
</configuration>
Then the class to read it could look like:-
VB Code:
  1. Public NotInheritable Class MonitoredPrintersSectionReader
  2.         Implements IConfigurationSectionHandler
  3.  
  4. #Region "Private constants"
  5.         Private Const SECTION_NAME As String = "monitoredPrinters"
  6.         Private Const ATTRIBUTE_NAME As String = "monitoredPrinter"
  7. #End Region
  8.  
  9.         Shared Sub New()
  10.             ConfigurationSettings.GetConfig(SECTION_NAME)
  11.         End Sub
  12.  
  13.         Public Shared Function GetMonitoredPrintersCollection() As Collection
  14.             Return CType(System.Configuration.ConfigurationSettings.GetConfig(SECTION_NAME), Collection)
  15.         End Function
  16.  
  17. #Region "IConfigurationSectionHandler interface"
  18.         Public Function Create( _
  19.                  ByVal parent As Object, _
  20.                  ByVal configContext As Object, _
  21.                  ByVal section As XmlNode _
  22.                  ) As Object Implements IConfigurationSectionHandler.Create
  23.  
  24.  
  25.             Dim retVal As New Collection()
  26.  
  27.             If section.HasChildNodes Then
  28.                 Dim childNode As XmlNode
  29.                 For Each childNode In section.ChildNodes
  30.                     If childNode.Name = ATTRIBUTE_NAME Then
  31.                         retVal.Add(childNode.Attributes.ItemOf("DeviceName").Value)
  32.                     End If
  33.                 Next
  34.             End If
  35.  
  36.             Return retVal
  37.         End Function
  38. #End Region
  39.  
  40.         Private Sub New()
  41.             '\\ make this class non creatable
  42.         End Sub
  43.     End Class

Hope this is useful,
Duncan