public static T Clone<T>(T obj) { using (MemoryStream stream = new MemoryStream()) { SilverlightSerializer.Serialize(obj, stream); stream.Position = 0; return (T) SilverlightSerializer.Deserialize(stream); } }
// get records matching year and month var iEnumSales = dsc.Where(x => x.YearMonth.Year == year && x.YearMonth.Month == month).ToList(); var salesList = new DailySalesCollection(); // to prevent modifying the static collection later, we clone/copy the iEnumSales linq query results salesList.AddRange(ObjectHelper.Clone(iEnumSales));
Remember Me
Page rendered at Thursday, February 23, 2012 8:19:58 AM (South Africa Standard Time, UTC+02:00)
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.