共用方式為


TaskLoggingHelper.FormatResourceString(String, Object[]) Method

Definition

Loads the specified resource string and optionally formats it using the given arguments. The current thread's culture is used for formatting.

Requires the owner task to have registered its resources either via the Task (or TaskMarshalByRef) base class constructor, or the Task.TaskResources (or AppDomainIsolatedTask.TaskResources) property.

Thread safe.

public:
 virtual System::String ^ FormatResourceString(System::String ^ resourceName, ... cli::array <System::Object ^> ^ args);
public virtual string FormatResourceString (string resourceName, params object[] args);
abstract member FormatResourceString : string * obj[] -> string
override this.FormatResourceString : string * obj[] -> string
Public Overridable Function FormatResourceString (resourceName As String, ParamArray args As Object()) As String

Parameters

resourceName
String

The name of the string resource to load.

args
Object[]

Optional arguments for formatting the loaded string.

Returns

The formatted string.

Exceptions

Thrown when resourceName is null.

Thrown when the string resource indicated by resourceName does not exist.

Thrown when the TaskResources property of the owner task is not set.

Remarks

The culture of the current thread is used for formatting.

This method requires the owner task to have registered its resources with either the Task base class constructor, or the TaskResources property.

Applies to