System.Resources.ResourceReader.GetEnumerator Method

Returns an enumerator for this System.Resources.ResourceReader object.

Syntax

public IDictionaryEnumerator GetEnumerator ()

Returns

An enumerator for this System.Resources.ResourceReader object.

Remarks

Typically, you enumerate resources by calling the ResourceReader.GetEnumerator method and then repeatedly calling the IEnumerator.MoveNext method on the returned IDictionaryEnumerator object until the method returns false. The resource name is available from the IDictionaryEnumerator.Key property; its value from the IDictionaryEnumerator.Value property. The example illustrates how to enumerate resources in this way.

The implementation of the IDictionaryEnumerator.Value property by the System.Resources.ResourceReader class can throw the following exceptions:

You can handle the exception by calling the ResourceReader.GetResourceData(string, String@, Byte[]@) method to retrieve information about the data type and the byte array assigned to the named resource. For more information, see the "Retrieving Resources by Name with GetResourceData" section in the System.Resources.ResourceReader class topic.

Note:

The System.Resources.ResourceReader class includes two methods that return enumerators. The ResourceReader.GetEnumerator method returns an IDictionaryEnumerator interface object and is the recommended method to call when enumerating resources.

Requirements

Namespace: System.Resources
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0