What's the purpose of Clone?

38 Views Asked by At

I'm new to C# and working on existing project. I found this clone in all the Data classes, can someone tell me why is it necessary to do this? Any known issues if i don't use clone? Thanks in advance!

public class PreviewRequestDetails : ICloneable
    {

    [DataMember]
    public string Address { get; set; }

    ........


     public object Clone()
        {
            return new PreviewRequestDetails
            {
                Address = this.Address,
                Email = this.Email,
                Id = this.Id,
                Country = this.Country,
                Phone = this.Phone,
                Titles = this.Titles.Select(p => p.Clone() as Title).ToList(),
                CreatedBy = this.CreatedBy,
                CreatedOn = this.CreatedOn,
                UpdatedOn = this.UpdatedOn,
                Delete = this.Delete
            };
        }
}
0

There are 0 best solutions below