I have the following :
SortedDictionary<int, SortedDictionary<int, VolumeInfoItem>>
that I want to deepcopy.
VolumeInfoItem is the following class :
[Serializable]
public class VolumeInfoItem
{
public double up = 0;
public double down = 0;
public double neutral = 0;
public int dailyBars = 0;
}
I have created the following Extension method :
public static T DeepClone<T>(this T a)
{
using (MemoryStream stream = new MemoryStream())
{
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(stream, a);
stream.Position = 0;
return (T)formatter.Deserialize(stream);
}
}
I can't figure out how to get the deepCopy working ?