private static ISorted <SCG.KeyValuePair <K, V> > ClonePairs(TreeDictionary <K, V> template, bool isSnapshot) { TreeSet <SCG.KeyValuePair <K, V> > originalPairs = (TreeSet <SCG.KeyValuePair <K, V> >)template.Pairs; return(isSnapshot ? originalPairs.Snapshot() : (ISorted <SCG.KeyValuePair <K, V> >)originalPairs.Clone()); }