Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ErrorDetails Constructor (IResourceSupplier, String, String, Object[])

 

Updated: April 27, 2016

Applies To: Windows PowerShell

Initializes a new instance of the ErrorDetails class that contains a localizable version of a message based on a template string supplied by a Windows PowerShell provider.

Namespace:   System.Management.Automation
Assembly:  System.Management.Automation (in System.Management.Automation.dll)

public ErrorDetails(
	IResourceSupplier resourceSupplier,
	string baseName,
	string resourceId,
	params object[] args
)

Parameters

resourceSupplier
Type: System.Management.Automation.IResourceSupplier

An IResourceSupplier interface that represents the resource supplier. This entity is usually an instance of CmdletProvider.

baseName
Type: System.String

The root name of the resource manager. By default, this is the name of the ResourceManager.

resourceId
Type: System.String

The resource identifier that is specified by the Root name. By default, this is the identifier that is specified in the ResourceManager.

args
Type: System.Object[]

The arguments that are needed to translate the string. By default, Overload:System.String.Format is used to translate strings.

This constructor is a shortcut to build an instance of an ErrorDetails class by using the steps that are typically used to generate a localizable string. It is the preferred constructor over ErrorDetails(String) because of the localizable information about the error.

The replacement message text should conform to the .NET Framework design guidelines for writing exception messages with only small differences. Those guidelines state that exception messages should be targeted for developers. In contrast, these replacement messages should be targeted at the users of your cmdlet.

Cmdlet providers can override the behavior of this constructor by overriding the GetResourceString method. This is the first call the constructor makes to load a template string.

For more information about error records, see Windows PowerShell Error Records.

Return to top

Community Additions

Show: