Last active
July 18, 2018 10:56
-
-
Save serhatates/44e811d4b81c2d3805c070fd818d6d06 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ListExtension | |
{ | |
public static List<T> CloneList<T>(this List<T> list, List<T> oldlist) | |
{ | |
BinaryFormatter formatter = new BinaryFormatter(); | |
MemoryStream stream = new MemoryStream(); | |
formatter.Serialize(stream, oldlist); | |
stream.Position = 0; | |
return (List<T>)formatter.Deserialize(stream); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment