다음을 통해 공유


ProcessTask<TBusinessObject> Constructor (String, String, Converter<TBusinessObject, String>)

 

Initializes a new instance of the ProcessTask<TBusinessObject> class with the specified display name, file path, and the string that is returned from the specified delegate method. The string that is returned contains the command-line arguments for the program to be run.

Namespace:   Microsoft.WindowsServerSolutions.Administration.ObjectModel
Assembly:  Microsoft.WindowsServerSolutions.Administration.ObjectModel (in Microsoft.WindowsServerSolutions.Administration.ObjectModel.dll)

Syntax

public ProcessTask(
    string displayName,
    string filePath,
    Converter<TBusinessObject, string> businessObjectToCommandLineArg
)
public:
ProcessTask(
    String^ displayName,
    String^ filePath,
    Converter<TBusinessObject, String^>^ businessObjectToCommandLineArg
)
Public Sub New (
    displayName As String,
    filePath As String,
    businessObjectToCommandLineArg As Converter(Of TBusinessObject, String)
)

Parameters

  • filePath
    Type: System.String

    The path and name of the program that is assigned to the task.

  • businessObjectToCommandLineArg
    Type: System.Converter<TBusinessObject, String>

    A delegate method that is used to convert an instance of a business object to the command-line arguments for the program.

Exceptions

Exception Condition
ArgumentException

One or more of the parameters are not valid.

ArgumentNullException

One or more of the parameters are null.

Remarks

TBusinessObject represents a business object that encapsulates information and methods that relate to business data or business functionality. The information in the business object is exposed as properties.

Examples

The following code example shows how to initialize a ProcessTask<TBusinessObject> with a specified display name, file path, and delegate method. The delegate method returns a string that is used to run a program with command-line arguments that include information from the business object:

ProcessTask<BusinessObject>(
    "Ping Computer",
    @"C:\Windows\System32\ping.exe", 
    GetProcessString);

private static string GetProcessString(BusinessObject businessObj)
{
    return "-t " + businessObj.ComputerName;
}

See Also

ProcessTask<TBusinessObject> Overload
ProcessTask<TBusinessObject> Class
Microsoft.WindowsServerSolutions.Administration.ObjectModel Namespace

Return to top