Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/06/10 01:56:04 (13 years ago)
Author:
swagner
Message:

Merged cloning refactoring branch back into trunk (#922)

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Common/3.3/Cloner.cs

    r4068 r4722  
    5050    }
    5151    /// <summary>
     52    /// Creates a deep clone of a given deeply cloneable object.
     53    /// </summary>
     54    /// <param name="item">The object which should be cloned.</param>
     55    /// <returns>A clone of the given object.</returns>
     56    public T Clone<T>(T obj) where T : class, IDeepCloneable {
     57      if (obj == null) return null;
     58      IDeepCloneable clone;
     59      if (mapping.TryGetValue(obj, out clone))
     60        return (T)clone;
     61      else
     62        return (T)obj.Clone(this);
     63    }
     64    /// <summary>
    5265    /// Registers a new clone for a given deeply cloneable object.
    5366    /// </summary>
Note: See TracChangeset for help on using the changeset viewer.