public void Clear() { SetStateAttr(LibStateAttr.Changed, false); SetStateAttr(LibStateAttr.AllObjectsLoaded, false); if (types != null) { foreach (GType type in types) { type.Clear(); } types.Clear(); types = null; } if (allTypes != null) { allTypes.Clear(); } if (allRanges != null) { allRanges.Clear(); } colors.Clear(); layers.Clear(); views.Clear(); bgImages.Clear(); images.Clear(); scales.Clear(); selection.Clear(); idGenerator.Clear(); customTables.Clear(); LocalDataStoreSlot slot = Thread.GetNamedDataSlot(globalId.ToString()); Context context = Thread.GetData(slot) as Context; if (context != null) { Thread.SetData(slot, null); context.Dispose(); context = null; } }