Breyta

Deila með


ResourceManager Constructors

Definition

Initializes a new instance of the ResourceManager class.

Overloads

ResourceManager()

Initializes a new instance of the ResourceManager class with default values.

ResourceManager(Type)

Initializes a new instance of the ResourceManager class that looks up resources in satellite assemblies based on information from the specified type object.

ResourceManager(String, Assembly)

Initializes a new instance of the ResourceManager class that looks up resources contained in files with the specified root name in the given assembly.

ResourceManager(String, Assembly, Type)

Initializes a new instance of the ResourceManager class that uses a specified ResourceSet class to look up resources contained in files with the specified root name in the given assembly.

ResourceManager()

Source:
ResourceManager.cs
Source:
ResourceManager.cs
Source:
ResourceManager.cs

Initializes a new instance of the ResourceManager class with default values.

protected:
 ResourceManager();
protected ResourceManager ();
Protected Sub New ()

Remarks

This constructor is useful only if you write your own class that derives from the ResourceManager class.

Applies to

ResourceManager(Type)

Source:
ResourceManager.cs
Source:
ResourceManager.cs
Source:
ResourceManager.cs

Initializes a new instance of the ResourceManager class that looks up resources in satellite assemblies based on information from the specified type object.

public:
 ResourceManager(Type ^ resourceSource);
public ResourceManager (Type resourceSource);
new System.Resources.ResourceManager : Type -> System.Resources.ResourceManager
Public Sub New (resourceSource As Type)

Parameters

resourceSource
Type

A type from which the resource manager derives all information for finding .resources files.

Exceptions

The resourceSource parameter is null.

Remarks

For more information about this API, see Supplemental API remarks for ResourceManager constructor.

Applies to

ResourceManager(String, Assembly)

Source:
ResourceManager.cs
Source:
ResourceManager.cs
Source:
ResourceManager.cs

Initializes a new instance of the ResourceManager class that looks up resources contained in files with the specified root name in the given assembly.

public:
 ResourceManager(System::String ^ baseName, System::Reflection::Assembly ^ assembly);
public ResourceManager (string baseName, System.Reflection.Assembly assembly);
new System.Resources.ResourceManager : string * System.Reflection.Assembly -> System.Resources.ResourceManager
Public Sub New (baseName As String, assembly As Assembly)

Parameters

baseName
String

The root name of the resource file without its extension but including any fully qualified namespace name. For example, the root name for the resource file named MyApplication.MyResource.en-US.resources is MyApplication.MyResource.

assembly
Assembly

The main assembly for the resources.

Exceptions

The baseName or assembly parameter is null.

Remarks

For more information about this API, see Supplemental API remarks for ResourceManager constructor.

Notes to Inheritors

This constructor uses the system-provided ResourceSet implementation. To use a custom resource file format, you should derive from the ResourceSet class, override the GetDefaultReader() and GetDefaultWriter() methods, and pass that type to the ResourceManager(String, Assembly, Type) constructor. Using a custom ResourceSet can be useful for controlling resource caching policy or supporting your own resource file format, but is generally not necessary.

Applies to

ResourceManager(String, Assembly, Type)

Source:
ResourceManager.cs
Source:
ResourceManager.cs
Source:
ResourceManager.cs

Initializes a new instance of the ResourceManager class that uses a specified ResourceSet class to look up resources contained in files with the specified root name in the given assembly.

public:
 ResourceManager(System::String ^ baseName, System::Reflection::Assembly ^ assembly, Type ^ usingResourceSet);
public ResourceManager (string baseName, System.Reflection.Assembly assembly, Type? usingResourceSet);
public ResourceManager (string baseName, System.Reflection.Assembly assembly, Type usingResourceSet);
new System.Resources.ResourceManager : string * System.Reflection.Assembly * Type -> System.Resources.ResourceManager
Public Sub New (baseName As String, assembly As Assembly, usingResourceSet As Type)

Parameters

baseName
String

The root name of the resource file without its extension but including any fully qualified namespace name. For example, the root name for the resource file named MyApplication.MyResource.en-US.resources is MyApplication.MyResource.

assembly
Assembly

The main assembly for the resources.

usingResourceSet
Type

The type of the custom ResourceSet to use. If null, the default runtime ResourceSet object is used.

Exceptions

usingResourceset is not a derived class of ResourceSet.

The baseName or assembly parameter is null.

Remarks

The individual culture-specific resource files should be contained in satellite assemblies, and the default culture's resource file should be contained in the main assembly. A satellite assembly is assumed to contain resources for a single culture specified in that assembly's manifest, and is loaded as necessary.

Note

To retrieve resources from .resources files directly instead of retrieving them from assemblies, you must call the CreateFileBasedResourceManager method instead to instantiate a ResourceManager object.

If the resource file identified by baseName cannot be found in assembly, the method instantiates a ResourceManager object, but the attempt to retrieve a specific resource throws an exception, typically MissingManifestResourceException. For information about diagnosing the cause of the exception, see the "Handling the MissingManifestResourceException Exception" section of the ResourceManager class topic.

Note

The usingResourceSet parameter is used to support your own resource format, and will commonly be null. This is different from the constructor that takes a Type only.

Notes to Callers

This constructor lets you specify a ResourceSet implementation. If you do not want a specific ResourceSet implementation but would like to use a custom resource file format, you should derive from the ResourceSet class, override the GetDefaultReader() and GetDefaultWriter() methods, and pass that type to this constructor.

Applies to