I am working on some code written in C #. In this application, I have a custom collection defined as follows:
public class ResultList<T> : IEnumerable<T> { public List<T> Results { get; set; } public decimal CenterLatitude { get; set; } public decimal CenterLongitude { get; set; } }
After querying my database and populating the ResultList, I store it in the cache in memory. That way, I don't have to hit my database every time. This approach works for the first time. However, at subsequent loads this does not work, because the ResultList is updated, which is retrieved from the cache. I suspect a deep copy is occurring.
How to get a shallow copy of ResultList?
source share