DesignOnlyAttribute.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / CompMod / System / ComponentModel / DesignOnlyAttribute.cs / 1 / DesignOnlyAttribute.cs

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

/* 
 */ 
namespace System.ComponentModel {
    using System; 
    using System.Diagnostics;
    using System.Security.Permissions;

    ///  
    ///    Specifies whether a property can only be set at
    ///       design time. 
    ///  
    [AttributeUsage(AttributeTargets.All)]
    public sealed class DesignOnlyAttribute : Attribute { 
        private bool isDesignOnly = false;

        /// 
        ///     
        ///       Initializes a new instance of the  class.
        ///     
        ///  
        public DesignOnlyAttribute(bool isDesignOnly) {
            this.isDesignOnly = isDesignOnly; 
        }

        /// 
        ///     
        ///       Gets a value indicating whether a property
        ///       can be set only at design time. 
        ///     
        /// 
        public bool IsDesignOnly { 
            get {
                return isDesignOnly;
            }
        } 

        ///  
        ///     
        ///       Specifies that a property can be set only at design time. This
        ///    field is read-only. 
        ///    
        /// 
        public static readonly DesignOnlyAttribute Yes = new DesignOnlyAttribute(true);
 
        /// 
        ///     
        ///       Specifies 
        ///       that a
        ///       property can be set at design time or at run 
        ///       time. This field is read-only.
        ///    
        /// 
        public static readonly DesignOnlyAttribute No = new DesignOnlyAttribute(false); 

        ///  
        ///     
        ///       Specifies the default value for the , which is . This  field is
        ///       read-only. 
        ///    
        /// 
        public static readonly DesignOnlyAttribute Default = No;
 
        /// 
        ///  
        ///  
        public override bool IsDefaultAttribute() {
            return IsDesignOnly == Default.IsDesignOnly; 
        }

        public override bool Equals(object obj) {
            if (obj == this) { 
                return true;
            } 
 
            DesignOnlyAttribute other = obj as DesignOnlyAttribute;
 
            return (other != null) && other.isDesignOnly == isDesignOnly;
        }

        public override int GetHashCode() { 
            return isDesignOnly.GetHashCode();
        } 
    } 
}
                        

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