Export (0) Print
Expand All

ResourceManager.CreateFileBasedResourceManager Method

Returns a ResourceManager object that searches a specific directory instead of an assembly manifest for resources.

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

public static ResourceManager CreateFileBasedResourceManager(
	string baseName,
	string resourceDir,
	Type usingResourceSet
)

Parameters

baseName
Type: System.String

The root name of the resources. For example, the root name for the resource file named "MyResource.en-US.resources" is "MyResource".

resourceDir
Type: System.String

The name of the directory to search for the resources. resourceDir can be an absolute path or a relative path from the application directory.

usingResourceSet
Type: System.Type

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

Return Value

Type: System.Resources.ResourceManager
A new instance of a resource manager that searches the specified directory instead of an assembly manifest for resources.

ExceptionCondition
ArgumentNullException

The baseName or resourceDir parameter is null.

This method returns a resource manager that retrieves resources from a .resources file that is not embedded in an assembly. You can use this ResourceManager object to load resources for an ASP.NET page or to test a ResourceSet implementation. For an example that retrieves resources from a standalone .resources file, see the Retrieving Resources in Desktop Apps article.

This method 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.

Caution noteCaution

Using standalone .resources files in an ASP.NET app will break XCOPY deployment, because the resources remain locked until they are explicitly released by the ReleaseAllResources method. If you want to deploy resources with your ASP.NET apps, compile your .resources files into satellite assemblies.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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