ResourceSet Constructor (String)


Creates a new instance of the ResourceSet class using the system default ResourceReader that opens and reads resources from the given file.

Namespace:   System.Resources
Assembly:  mscorlib (in mscorlib.dll)

Public Sub New (
	fileName As String


Type: System.String

Resource file to read.

Exception Condition

The fileName parameter is null.

The following code example defines a new instance of the ResourceSet class for a specific file, iterates through the resources used by that file, and displays their contents to the console.

Imports System
Imports System.Resources
Imports System.Collections
Imports Microsoft.VisualBasic

Class EnumerateResources

   Public Shared Sub Main()
      ' Create a ResourceSet for the file items.resources.
      Dim rs As New ResourceSet("items.resources")      

      ' Create an IDictionaryEnumerator to read the data in the ResourceSet.
      Dim id As IDictionaryEnumerator = rs.GetEnumerator()

      ' Iterate through the ResourceSet and display the contents to the console. 
      While id.MoveNext()
         Console.WriteLine(ControlChars.NewLine + "[{0}] " + ControlChars.Tab + "{1}", id.Key, id.Value)
      End While 


   End Sub

End Class

.NET Framework
Available since 1.1
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top