/// <summary> /// Initializes a new instance of the Behavior class by copying it from /// another Behavior object. </summary> /// <param name="behavior"> /// The Behavior object to copied (and then disposed of). It must not be null. </param> /// <exception cref="ArgumentNullException">behavior is null. </exception> /// <remarks> /// This constructor is <c>protected</c> since this class is only meant to be used as a base for other behaviors. /// After the behavior.TextBox object is copied, Dispose is called on the behavior parameter. </remarks> /// <seealso cref="TextBox" /> /// <seealso cref="Dispose" /> protected Behavior(Behavior behavior) { if (behavior == null) throw new ArgumentNullException("behavior"); TextBox = behavior.TextBox; this.flags = behavior.flags; behavior.Dispose(); }
/// <summary> /// Initializes a new instance of the TextBox class by explicitly assigning its Behavior field. </summary> /// <param name="behavior"> /// The <see cref="Behavior" /> object to associate the textbox with. </param> /// <remarks> /// This constructor provides a way for derived classes to set the internal Behavior object /// to something other than the default value (such as <c>null</c>). </remarks> protected TextBox(Behavior behavior) { this.behavior = behavior; }