ValidationError.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / Validation / ValidationError.cs / 1305376 / ValidationError.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------

namespace System.Activities.Validation 
{
    using System; 
    using System.Globalization; 
    using System.Runtime;
 
    [Fx.Tag.XamlVisible(false)]
    public class ValidationError
    {
        public ValidationError(string message) 
            : this(message, false, string.Empty)
        { 
        } 

        public ValidationError(string message, bool isWarning) 
            : this(message, isWarning, string.Empty)
        {
        }
 
        public ValidationError(string message, bool isWarning, string propertyName)
            : this(message, isWarning, propertyName, null) 
        { 
        }
        internal ValidationError(string message, Activity activity) 
            : this(message, false, string.Empty, activity)
        {
        }
 
        internal ValidationError(string message, bool isWarning, Activity activity)
            : this(message, isWarning, string.Empty, activity) 
        { 
        }
 
        internal ValidationError(string message, bool isWarning, string propertyName, Activity activity)
        {
            this.Message = message;
            this.IsWarning = isWarning; 
            this.PropertyName = propertyName;
 
            if (activity != null) 
            {
                this.Source = activity; 
                this.Id = activity.Id;
            }
        }
 
        public string Message
        { 
            get; 
            internal set;
        } 

        public bool IsWarning
        {
            get; 
            private set;
        } 
 
        public string PropertyName
        { 
            get;
            private set;
        }
 
        public string Id
        { 
            get; 
            internal set;
        } 

        public Activity Source
        {
            get; 
            internal set;
        } 
 
        public override string ToString()
        { 
            return string.Format(CultureInfo.InvariantCulture,
                "ValidationError {{ Message = {0}, Source = {1}, PropertyName = {2}, IsWarning = {3} }}",
                this.Message,
                this.Source, 
                this.PropertyName,
                this.IsWarning); 
        } 
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK