Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

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:
ResourceSet(
	String^ fileName
)

Parameters

fileName
Type: System::String^

Resource file to read.

Exception Condition
ArgumentNullException

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.

using namespace System;
using namespace System::Resources;
using namespace System::Collections;
int main()
{

   // Create a ResourceSet for the file items.resources.
   ResourceSet^ rs = gcnew ResourceSet( "items.resources" );

   // Create an IDictionaryEnumerator* to read the data in the ResourceSet.
   IDictionaryEnumerator^ id = rs->GetEnumerator();

   // Iterate through the ResourceSet and display the contents to the console.
   while ( id->MoveNext() )
      Console::WriteLine( "\n [{0}] \t {1}", id->Key, id->Value );

   rs->Close();
}

.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show:
© 2017 Microsoft