コード例 #1
0
        /// <summary>
        /// Creates a new object that is a copy of the source instance.
        /// </summary>
        /// <param name="source">The source object to copy.</param>
        /// <returns>A new object that is a copy of the source instance.</returns>
        public static object Clone(object source)
        {
            var cloner = new ObjectCloner();

            return(cloner.Clone(source));
        }
コード例 #2
0
        /// <summary>
        /// Creates a new object that is a copy of the source instance.
        /// </summary>
        /// <typeparam name="T">The type of the object to clone.</typeparam>
        /// <param name="source">The source object to copy.</param>
        /// <returns>A new object that is a copy of the source instance.</returns>
        public static T Clone <T>(T source)
        {
            var cloner = new ObjectCloner();

            return((T)cloner.Clone(source));
        }