This documentation is archived and is not being maintained.

ValidationErrorCollection Class

Holds a collection of ValidationError objects.

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

public sealed class ValidationErrorCollection : Collection<ValidationError>

The following example shows how to create and manipulate validation errors and 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 SendEMailActivity.cs file. For more information, see Send Mail Activity.

private void ValidateEmailProperties(ValidationErrorCollection validationErrors, SendEmailActivity activity)
    // Validate the To property 
    if (String.IsNullOrEmpty(activity.To))

    else if (!activity.To.Contains("@"))
        validationErrors.Add(new ValidationError("Invalid To e-mail address", InvalidToAddress, false, SendEmailActivity.ToProperty.Name));


    // Validate the From property 
    if (String.IsNullOrEmpty(activity.From))
    else if (!activity.From.Contains("@"))
        validationErrors.Add(new ValidationError("Invalid From e-mail address", InvalidFromAddress, false, SendEmailActivity.FromProperty.Name));



Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0