Search code examples
c#asp.netclone

clone a class object into a object of same class


I have a class lets say students

with properties as

public string sname{get;set;}
public int sid{get;set;}
public studentprofile sprofile{get;set;}

where student profile is another class with some other properties .

I want to do deep copy of the students object.

How to do that.


Solution

  • I think this is already answered. Have a look at this solution : How do you do a deep copy of an object in .NET (C# specifically)?