Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/29/10 17:38:42 (13 years ago)
Author:
swagner
Message:

Finished cloning refactoring of HeuristicLab.Common, HeuristicLab.Collections and HeuristicLab.Core (#922)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactoring/HeuristicLab.Core/3.3/NamedItem.cs

    r4477 r4668  
    6666    }
    6767
     68    [StorableConstructor]
     69    protected NamedItem(bool deserializing) : base(deserializing) { }
     70    protected NamedItem(NamedItem original, Cloner cloner)
     71      : base(original, cloner) {
     72      name = original.name;
     73      description = original.description;
     74    }
    6875    /// <summary>
    6976    /// Initializes a new instance of <see cref="Variable"/> with name <c>Anonymous</c>
     
    9198      else this.description = description;
    9299    }
    93     [StorableConstructor]
    94     protected NamedItem(bool deserializing) : base(deserializing) { }
    95 
    96     /// <summary>
    97     /// Clones the current instance (deep clone).
    98     /// </summary>
    99     /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param>
    100     /// <returns>The cloned object as <see cref="Variable"/>.</returns>
    101     public override IDeepCloneable Clone(Cloner cloner) {
    102       NamedItem clone = (NamedItem)base.Clone(cloner);
    103       clone.name = name;
    104       clone.description = description;
    105       return clone;
    106     }
    107100
    108101    /// <summary>
     
    121114    /// <param name="e">The event arguments of the changing.</param>
    122115    protected virtual void OnNameChanging(CancelEventArgs<string> e) {
    123       if (NameChanging != null)
    124         NameChanging(this, e);
     116      var handler = NameChanging;
     117      if (handler != null) handler(this, e);
    125118    }
    126119    /// <inheritdoc/>
     
    131124    /// <remarks>Calls <see cref="ItemBase.OnChanged"/>.</remarks>
    132125    protected virtual void OnNameChanged() {
    133       if (NameChanged != null)
    134         NameChanged(this, EventArgs.Empty);
     126      var handler = NameChanged;
     127      if (handler != null) handler(this, EventArgs.Empty);
    135128      OnToStringChanged();
    136129    }
     
    142135    /// <remarks>Calls <see cref="ItemBase.OnChanged"/>.</remarks>
    143136    protected virtual void OnDescriptionChanged() {
    144       if (DescriptionChanged != null)
    145         DescriptionChanged(this, EventArgs.Empty);
     137      var handler = DescriptionChanged;
     138      if (handler != null) handler(this, EventArgs.Empty);
    146139    }
    147140  }
Note: See TracChangeset for help on using the changeset viewer.