using System.Collections.Generic;
private List<int> _snapshot;
public Snapshot(List<int> source)
public List<int> GetSnapshot()
public static void Main()
List<int> items = new List<int>() { 1, 2 };
var snapshot = new Snapshot(items);
if (snapshot.GetSnapshot().Count != 2)
throw new Exception("Adding items to collection should not affect snapshot");
snapshot.GetSnapshot().Add(3);
if (snapshot.GetSnapshot().Count != 2)
throw new Exception("Adding items to returned data should not affect snapshot");