ResourceReader Constructor (String^)
Initializes a new instance of the ResourceReader class for the specified named resource file.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- fileName
-
Type:
System::String^
The path and name of the resource file to read. filename is not case-sensitive.
| Exception | Condition |
|---|---|
| ArgumentNullException | The fileName parameter is null. |
| FileNotFoundException | The file cannot be found. |
| IOException | An I/O error has occurred. |
| BadImageFormatException | The resource file has an invalid format. For example, the length of the file may be zero. |
The ResourceReader(String^) constructor instantiates a ResourceReader object that retrieves resources from a standalone .resources file. To retrieve resources from an embedded .resources file, use the ResourceReader(Stream^) constructor.
Security Note
|
|---|
Using an instance of this object with untrusted data is a security risk. Use this object only with trusted data. For more information, see Untrusted Data Security Risks. |
The example in this section uses the following .txt file named PatientForm.txt to define the resources used by an application.
Title="Top Pet Animal Clinic" Label1="Patient Number:" Label2="Pet Name:" Label3="Species:" Label4="Breed:" Label5="Date of Birth:" Label6="Age:" Label7="Owner:" Label8="Address:" Label9="Home Phone:" Label10="Work Phone:" Label11="Mobile Phone:"
You can compile this .txt file into a .resources file by issuing the following command:
resgen PatientForm.txt
The following example enumerates the resources in PatientForm.resources and displays the name and value of each.
Available since 1.1
