Export (0) Print
Expand All

ResourceManager Constructor (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.

Namespace:  System.Resources
Assembly:  mscorlib (in mscorlib.dll)

public ResourceManager(
	string baseName,
	Assembly assembly,
	Type usingResourceSet
)

Parameters

baseName
Type: System.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
Type: System.Reflection.Assembly

The main assembly for the resources.

usingResourceSet
Type: System.Type

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

ExceptionCondition
ArgumentException

usingResourceset is not a derived class of ResourceSet.

ArgumentNullException

The baseName or assembly parameter is null.

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.

NoteNote

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.

NoteNote

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.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft