When using Swig to port code to C ++, you can add methods to your own C ++ type using %extend . add methods to a C # shell class using %typemap(cscode) .
Where the method already exists in the wrapper class, is there a way to add additional lines of code?
For example, my C # shell method looks like this:
public void ItemChanged(CollectionObject collectionObject, string propertyName) { mynamespacePINVOKE.mynamespace_DataObjectCollection_ItemChanged(swigCPtr, CollectionObject.getCPtr(collectionObject), propertyName); if (mynamespacePINVOKE.SWIGPendingException.Pending) throw mynamespacePINVOKE.SWIGPendingException.Retrieve(); }
I would like to add a line of code:
public void ItemChanged(CollectionObject collectionObject, string propertyName) { mynamespacePINVOKE.mynamespace_DataObjectCollection_ItemChanged(swigCPtr, CollectionObject.getCPtr(collectionObject), propertyName); if (mynamespacePINVOKE.SWIGPendingException.Pending) throw mynamespacePINVOKE.SWIGPendingException.Retrieve(); **insert my line of code here** }
source share