/// <summary>\r
/// The previous snapshot listing\r
/// </summary>\r
- public readonly IEnumerable<ObjectInfo> Previous;\r
+ public readonly ObjectInfo[] Previous;\r
\r
/// <summary>\r
/// The current snapshot listing\r
/// </summary>\r
- public readonly IEnumerable<ObjectInfo> Current;\r
+ public readonly ObjectInfo[] Current;\r
\r
/// <summary>\r
/// Common objects, lazily evalueated. \r
/// </summary>\r
public readonly Lazy<IEnumerable<ObjectInfo>> Common;\r
\r
- public State(IEnumerable<ObjectInfo> previous, IEnumerable<ObjectInfo> current)\r
+ public State(ObjectInfo[] previous, ObjectInfo[] current)\r
{\r
- Previous = previous ?? new List<ObjectInfo>();\r
- Current = current ?? new List<ObjectInfo>();\r
+ Previous = previous ?? new ObjectInfo[0];\r
+ Current = current ?? new ObjectInfo[0];\r
\r
Common=new Lazy<IEnumerable<ObjectInfo>>(() =>\r
Current.Join(Previous,\r
/// Default constructor. Initializes the Current and Previous listings to empty lists\r
/// </summary>\r
public SnapshotDifferencer()\r
- :this(new List<ObjectInfo>(),new List<ObjectInfo>())\r
{\r
- }\r
-\r
- /// <summary>\r
- /// Creates a new differencer using the specified previous and current list. Null lists\r
- /// are replaced with empty lists\r
- /// </summary>\r
- /// <param name="previous"></param>\r
- /// <param name="current"></param>\r
- public SnapshotDifferencer(IEnumerable<ObjectInfo> previous,IEnumerable<ObjectInfo> current )\r
- {\r
- _state=new State(previous,current);\r
+ var empty = new ObjectInfo[0]; \r
+ _state = new State(empty, empty);\r
}\r
\r
/// <summary>\r
/// <returns></returns>\r
public SnapshotDifferencer Post(IEnumerable<ObjectInfo> list)\r
{\r
- List<ObjectInfo> newCurrent=null;\r
+ ObjectInfo[] newCurrent=null;\r
if (list != null)\r
{\r
//The state field holds the old state\r
newCurrent = list.Replace(\r
info => info is NoModificationInfo,\r
noMod => oldState.Current.Where(noMod.CorrespondsTo))\r
- .ToList();\r
+ .ToArray();\r
}\r
//Set the new state\r
_state = new State(_state.Current, newCurrent);\r