PropertyValidationContext.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 / WF / Common / AuthoringOM / Compiler / Validation / PropertyValidationContext.cs / 1305376 / PropertyValidationContext.cs

                            namespace System.Workflow.ComponentModel.Compiler 
{
    using System;
    using System.Reflection;
 
    #region PropertyValidationContext
    public sealed class PropertyValidationContext 
    { 
        private string propertyName = string.Empty;
        private object propertyOwner = null; 
        private object propertyInfo = null;

        public PropertyValidationContext(object propertyOwner, PropertyInfo propertyInfo, string propertyName)
        { 
            if (propertyName == null)
                throw new ArgumentNullException("propertyName"); 
            if (propertyOwner == null) 
                throw new ArgumentNullException("propertyOwner");
 
            this.propertyOwner = propertyOwner;
            this.propertyName = propertyName;
            this.propertyInfo = propertyInfo;
        } 

        public PropertyValidationContext(object propertyOwner, DependencyProperty dependencyProperty) 
        { 
            if (propertyOwner == null)
                throw new ArgumentNullException("propertyOwner"); 

            this.propertyOwner = propertyOwner;
            this.propertyInfo = dependencyProperty;
        } 

        public string PropertyName 
        { 
            get
            { 
                if (this.propertyInfo is DependencyProperty)
                    return ((DependencyProperty)this.propertyInfo).Name;
                else
                    return this.propertyName; 
            }
        } 
 
        public object PropertyOwner
        { 
            get
            {
                return this.propertyOwner;
            } 
        }
 
        public object Property 
        {
            get 
            {
                return this.propertyInfo;
            }
        } 
    }
    #endregion 
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.


                        

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