ValidationErrorCollection Constructor (ValidationErrorCollection)


Initializes a new instance of the ValidationErrorCollection class by using a ValidationErrorCollection.

Namespace:   System.Workflow.ComponentModel.Compiler
Assembly:  System.Workflow.ComponentModel (in System.Workflow.ComponentModel.dll)

public ValidationErrorCollection(
	ValidationErrorCollection value

The following example shows how to create and manipulate a validation error collection as part of a custom validation routine.

This code example is part of the Send E-mail SDK sample and is from the SendMailActivity.cs file. For more information, see Send Mail Activity.

public class SendEmailValidator : System.Workflow.ComponentModel.Compiler.ActivityValidator
    // Define private constants for the Validation Errors 
    private const int InvalidToAddress = 1;
    private const int InvalidFromAddress = 2;
    private const int InvalidSMTPPort = 3;

    //customizing the default activity validation
    public override ValidationErrorCollection ValidateProperties(ValidationManager manager, object obj)

        // Create a new collection for storing the validation errors
        ValidationErrorCollection validationErrors = base.ValidateProperties(manager, obj);

        SendEmailActivity activity = obj as SendEmailActivity;
        if (activity != null)
            // Validate the Email and SMTP Properties
            this.ValidateEmailProperties(validationErrors, activity);
            this.ValidateSMTPProperties(validationErrors, activity);
        return validationErrors;

.NET Framework
Available since 3.0
Return to top