private void RestoreViewState(MemoryElement oldRoot, MemoryElement newRoot)
{
foreach (MemoryElement element in newRoot.children)
{
element.ExpandChildren();
if (element.ChildCount() != 0)
{
MemoryElement outChild = null;
if (this.FindNamedChild(element.name, oldRoot.children, out outChild))
{
element.expanded = outChild.expanded;
if (element.expanded)
{
this.RestoreViewState(outChild, element);
}
}
}
}
}