Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ResourceSet Constructor (String)

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.


The fileName parameter is Nothing.

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

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8
© 2015 Microsoft