Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Resources.​ResourceManager

Assembly: System.Runtime

Inheritance: object → ResourceManager

Represents a resource manager that provides convenient access to culture-specific resources at run time.

Fields and Constants

public static readonly int
HeaderVersionNumber
Specifies the version of resource file headers that the current implementation of <see cref="T:System.Resources.ResourceManager" /> can interpret and produce.
public static readonly int
MagicNumber
Holds the number used to identify resource files.
MainAssembly
Specifies the main assembly that contains the resources.

Properties

public string
BaseName
Gets the root name of the resource files that the <see cref="T:System.Resources.ResourceManager" /> searches for resources.
FallbackLocation
Gets or sets the location from which to retrieve default fallback resources.
public bool
IgnoreCase
Gets or sets a value that indicates whether the resource manager allows case-insensitive resource lookups in the <see cref="M:System.Resources.ResourceManager.GetString(System.String)" /> and <see cref="M:System.Resources.ResourceManager.GetObject(System.String)" /> methods.
public Type
ResourceSetType
Gets the type of the resource set object that the resource manager uses to construct a <see cref="T:System.Resources.ResourceSet" /> object.

Methods

public static ResourceManager
CreateFileBasedResourceManager​(string baseName, string resourceDir, Type? usingResourceSet)
Returns a <see cref="T:System.Resources.ResourceManager" /> object that searches a specific directory instead of an assembly manifest for resources.
Returns A new instance of a resource manager that searches the specified directory instead of an assembly manifest for resources.
baseName The root name of the resources. For example, the root name for the resource file named "MyResource.en-US.resources" is "MyResource".
resourceDir The name of the directory to search for the resources. <paramref name="resourceDir" /> can be an absolute path or a relative path from the application directory.
usingResourceSet The type of the custom <see cref="T:System.Resources.ResourceSet" /> to use. If <see langword="null" /> , the default runtime <see cref="T:System.Resources.ResourceSet" /> object is used.
protected static Globalization.​CultureInfo
GetNeutralResourcesLanguage​(Reflection.​Assembly a)
Returns culture-specific information for the main assembly's default resources by retrieving the value of the <see cref="T:System.Resources.NeutralResourcesLanguageAttribute" /> attribute on a specified assembly.
Returns The culture from the <see cref="T:System.Resources.NeutralResourcesLanguageAttribute" /> attribute, if found; otherwise, the invariant culture.
a The assembly for which to return culture-specific information.
public object
GetObject​(string name)
Returns the value of the specified non-string resource.
Returns The value of the resource localized for the caller's current culture settings. If an appropriate resource set exists but <paramref name="name" /> cannot be found, the method returns <see langword="null" /> .
name The name of the resource to get.
public object
GetObject​(string name, Globalization.​CultureInfo culture)
Gets the value of the specified non-string resource localized for the specified culture.
Returns The value of the resource, localized for the specified culture. If an appropriate resource set exists but <paramref name="name" /> cannot be found, the method returns <see langword="null" /> .
name The name of the resource to get.
culture The culture for which the resource is localized. If the resource is not localized for this culture, the resource manager uses fallback rules to locate an appropriate resource. If this value is <see langword="null" /> , the <see cref="T:System.Globalization.CultureInfo" /> object is obtained by using the <see cref="P:System.Globalization.CultureInfo.CurrentUICulture" /> property.
protected string
GetResourceFileName​(Globalization.​CultureInfo culture)
Generates the name of the resource file for the given <see cref="T:System.Globalization.CultureInfo" /> object.
Returns The name that can be used for a resource file for the given <see cref="T:System.Globalization.CultureInfo" /> object.
culture The culture object for which a resource file name is constructed.
public ResourceSet
GetResourceSet​(Globalization.​CultureInfo culture, bool createIfNotExists, bool tryParents)
Retrieves the resource set for a particular culture.
Returns The resource set for the specified culture.
culture The culture whose resources are to be retrieved.
createIfNotExists <see langword="true" /> to load the resource set, if it has not been loaded yet; otherwise, <see langword="false" /> .
tryParents <see langword="true" /> to use resource fallback to load an appropriate resource if the resource set cannot be found; <see langword="false" /> to bypass the resource fallback process.
protected static Version
GetSatelliteContractVersion​(Reflection.​Assembly a)
Returns the version specified by the <see cref="T:System.Resources.SatelliteContractVersionAttribute" /> attribute in the given assembly.
Returns The satellite contract version of the given assembly, or <see langword="null" /> if no version was found.
a The assembly to check for the <see cref="T:System.Resources.SatelliteContractVersionAttribute" /> attribute.
GetStream​(string name)
Returns an unmanaged memory stream object from the specified resource.
Returns An unmanaged memory stream object that represents a resource.
name The name of a resource.
GetStream​(string name, Globalization.​CultureInfo culture)
Returns an unmanaged memory stream object from the specified resource, using the specified culture.
Returns An unmanaged memory stream object that represents a resource.
name The name of a resource.
culture The culture to use for the resource lookup. If <paramref name="culture" /> is <see langword="null" /> , the culture for the current thread is used.
public string
GetString​(string name)
Returns the value of the specified string resource.
Returns The value of the resource localized for the caller's current UI culture, or <see langword="null" /> if <paramref name="name" /> cannot be found in a resource set.
name The name of the resource to retrieve.
public string
GetString​(string name, Globalization.​CultureInfo culture)
Returns the value of the string resource localized for the specified culture.
Returns The value of the resource localized for the specified culture, or <see langword="null" /> if <paramref name="name" /> cannot be found in a resource set.
name The name of the resource to retrieve.
culture An object that represents the culture for which the resource is localized.
protected ResourceSet
InternalGetResourceSet​(Globalization.​CultureInfo culture, bool createIfNotExists, bool tryParents)
Provides the implementation for finding a resource set.
Returns The specified resource set.
culture The culture object to look for.
createIfNotExists <see langword="true" /> to load the resource set, if it has not been loaded yet; otherwise, <see langword="false" /> .
tryParents <see langword="true" /> to check parent <see cref="T:System.Globalization.CultureInfo" /> objects if the resource set cannot be loaded; otherwise, <see langword="false" /> .
public void
ReleaseAllResources​()
Tells the resource manager to call the <see cref="M:System.Resources.ResourceSet.Close" /> method on all <see cref="T:System.Resources.ResourceSet" /> objects and release all resources.
public bool
Equals​(object obj)
Inherited from object
Determines whether the specified object is equal to the current object.
Returns <see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" /> .
obj The object to compare with the current object.
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public int
GetHashCode​()
Inherited from object
Serves as the default hash function.
Returns A hash code for the current object.
public Type
GetType​()
Inherited from object
Gets the <see cref="T:System.Type" /> of the current instance.
Returns The exact runtime type of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Creates a shallow copy of the current <see cref="T:System.Object" /> .
Returns A shallow copy of the current <see cref="T:System.Object" /> .
public string
ToString​()
Inherited from object
Returns a string that represents the current object.
Returns A string that represents the current object.