Επεξεργασία

Κοινή χρήση μέσω


ResourceSet Class

Definition

Stores all the resources localized for one particular culture, ignoring all other cultures, including any fallback rules.

public ref class ResourceSet : IDisposable, System::Collections::IEnumerable
public class ResourceSet : IDisposable, System.Collections.IEnumerable
[System.Serializable]
public class ResourceSet : IDisposable, System.Collections.IEnumerable
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public class ResourceSet : IDisposable, System.Collections.IEnumerable
type ResourceSet = class
    interface IEnumerable
    interface IDisposable
type ResourceSet = class
    interface IDisposable
    interface IEnumerable
[<System.Serializable>]
type ResourceSet = class
    interface IDisposable
    interface IEnumerable
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type ResourceSet = class
    interface IDisposable
    interface IEnumerable
Public Class ResourceSet
Implements IDisposable, IEnumerable
Inheritance
ResourceSet
Derived
Attributes
Implements

Remarks

Important

Calling methods from this class with untrusted data is a security risk. Call the methods from this class only with trusted data. For more information, see Validate All Inputs.

The ResourceSet class enumerates over an IResourceReader, loading every name and value, and storing them in a Hashtable. A custom IResourceReader can be used.

You can instantiate a ResourceSet object that represents the resources of a specific culture by calling the ResourceManager.GetResourceSet method.

Important

This type implements the IDisposable interface. When you have finished using the type, you should dispose of it either directly or indirectly. To dispose of the type directly, call its Dispose method in a try/catch block. To dispose of it indirectly, use a language construct such as using (in C#) or Using (in Visual Basic). For more information, see the "Using an Object that Implements IDisposable" section in the IDisposable interface topic.

Notes to Inheritors

Derived classes of ResourceSet that use their own resource reader and writer should override GetDefaultReader(), and GetDefaultWriter(), to provide the appropriate functionality for interpreting the resource set.

Constructors

ResourceSet()

Initializes a new instance of the ResourceSet class with default properties.

ResourceSet(IResourceReader)

Creates a new instance of the ResourceSet class using the specified resource reader.

ResourceSet(Stream)

Creates a new instance of the ResourceSet class using the system default ResourceReader that reads resources from the given stream.

ResourceSet(String)

Creates a new instance of the ResourceSet class using the system default ResourceReader that opens and reads resources from the given file.

Fields

Reader

Indicates the IResourceReader used to read the resources.

Table

The Hashtable in which the resources are stored.

Methods

Close()

Closes and releases any resources used by this ResourceSet.

Dispose()

Disposes of the resources (other than memory) used by the current instance of ResourceSet.

Dispose(Boolean)

Releases resources (other than memory) associated with the current instance, closing internal managed objects if requested.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetDefaultReader()

Returns the preferred resource reader class for this kind of ResourceSet.

GetDefaultWriter()

Returns the preferred resource writer class for this kind of ResourceSet.

GetEnumerator()

Returns an IDictionaryEnumerator that can iterate through the ResourceSet.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetObject(String, Boolean)

Searches for a resource object with the specified name in a case-insensitive manner, if requested.

GetObject(String)

Searches for a resource object with the specified name.

GetString(String, Boolean)

Searches for a String resource with the specified name in a case-insensitive manner, if requested.

GetString(String)

Searches for a String resource with the specified name.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ReadResources()

Reads all the resources and stores them in a Hashtable indicated in the Table property.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Explicit Interface Implementations

IEnumerable.GetEnumerator()

Returns an IEnumerator object to avoid a race condition with Dispose. This member is not intended to be used directly from your code.

Extension Methods

Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Applies to