What is the C# equivalent of this C++ code?
private:
static EdsError EDSCALLBACK ProgressFunc (
EdsUInt32 inPercent,
EdsVoid * inContext,
EdsBool * outCancel
)
{
Command *command = (Command *)inContext;
CameraEvent e("ProgressReport", &inPercent);
command->getCameraModel()->notifyObservers(&e);
return EDS_ERR_OK;
}
This is a rough translation for illustration purposes:
(
EdsErrorhas been changed tovoid, because we use exceptions in C# instead of error codes;EDSCALLBACKis defined as__stdcallwhich is irrelevant here; the code only works if all implied classes and methods exist; idiomatic C# would be the use ofevent/EventHandler<T>/EventArgs instead of a “NotifyObservers” method; I assume you don’t want to do any interop with C++).