Provides a default implementation of the IResourceReader interface and implements a resource reader. Resource readers are used to read resource name and resource value pairs from ".resources" files. These methods are used to advance to the next resource and read the name and value of each resource in the ".resources" file. This class can be used to enumerate the resources only one time.
Object
ResourceReader
[Visual Basic] Public Class ResourceReader Implements IResourceReader, IEnumerable [C#] public class ResourceReader : IResourceReader, IEnumerable [C++] public __gc class ResourceReader : public IResourceReader, IEnumerable [JScript] public class ResourceReader implements IResourceReader, IEnumerable
The TBD provides details on the default resource file form
Example: Reading the "mscorlib.resources" resource.
The "mscorlib.resources" resource will be used by the base class library in order to localize the message strings carried by exceptions. The following code sample displays the contents of the "mscorlib.resources resource" on the console:
[C#]
using System; using System.Resources; public class ReadResources { public static void Main(string[] args) { ResourceReader reader = new ResourceReader("mscorlib.resources"); while (reader.MoveNext() != null) { Console.WriteLine(); Console.WriteLine("Name: {0}", reader.GetKey()); Console.WriteLine("Value: {0}", reader.GetValue()); } reader.Close(); } }
Namespace: System.Resources
Assembly: mscorlib.dll