public void Batch(Action codeBlock)
{
if (!IsTrackingEnabled) return;
if (codeBlock == null) throw new ArgumentNullException("codeBlock");
BeginBatch();
try {
codeBlock();
}
finally {
// Must not call EndBatch() because CheckPreconditions() might return false
BaseEvent @event = InternalEndBatch(_undoStack);
if (@event != null)
PerformPostMarkAction(@event);
}
}