Name

ReadOnlyAttribute

Synopsis

If you mark a property with this attribute, you can indicate whether it is read-only or read- write in the designer. Compare this with the DesignOnlyAttribute.

You can use the IsReadOnly property to determine the state of the attribute, but an instance of the attribute can also be compared against the Yes and No values for equality.


public sealed class ReadOnlyAttribute : Attribute {

// Public Constructors

   public ReadOnlyAttribute(bool isReadOnly);

// Public Static Fields

   public static readonly ReadOnlyAttribute Default;  // =System.ComponentModel.ReadOnlyAttribute

   public static readonly ReadOnlyAttribute No;  // =System.ComponentModel.ReadOnlyAttribute

   public static readonly ReadOnlyAttribute Yes;  // =System.ComponentModel.ReadOnlyAttribute

                  // Public Instance Properties

   public bool IsReadOnly{get; }

// Public Instance Methods

   public override bool Equals(object value);  // overrides Attribute

   public override int GetHashCode();  // overrides Attribute

   public override bool IsDefaultAttribute();  // overrides Attribute

}

Hierarchy

System.Object System.Attribute ReadOnlyAttribute

Valid On

All

Get .NET Windows Forms in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.