Undo operation and last changes stack

Discussion created by mik1971 on Jul 10, 2010
The question is how to catch last changes in ArcMap edit session and to know old value (before change). I catch Undo operation and use IDataChangesEx.
I posted my code below. All the time I get null in modifiedClass (see the code). What is the reason?

I use versioned SDE feature class.

private void OnUndoOperation()
IFeatureClass pFC = ((mApplication.Document as IMxDocument).FocusMap.get_Layer(0) as IFeatureLayer).FeatureClass;
IWorkspaceEdit2 pWorkspaceEdit2 = (pFC as IDataset).Workspace as IWorkspaceEdit2;

IDataChangesEx dataChangesEx = pWorkspaceEdit2.get_EditDataChanges(esriEditDataCh angesType.esriEditDataChangesWithinSession);

IEnumBSTR modifiedClasses = dataChangesEx.ModifiedClasses;
string modifiedClass = modifiedClasses.Next();
IDifferenceCursorEx differenceCursorEx = dataChangesEx.ExtractEx
(modifiedClass, esriDifferenceType.esriDifferenceTypeUpdateNoChang e);