That should beCode:[StructLayout (LayoutKind.Sequential)] class Parameters { public double a, b, c; }
Code:[StructLayout (LayoutKind.Sequential)] struct Parameters { public double a, b, c; }Assuming the "void* par" part refers to a Parameters type, you can safely change this to:Code:double quadratic (double x, void *par)
Code:double quadratic (double x, ref Parameters par) // called like: Parameters p = new Parameters { a = 1, b = 2, c = 3}; quadratic (5, ref p);This can be rewritten to use ref Parameters instead of IntPtr aswell.Code:double average (Func f, IntPtr p, double a, double b, int n);
That should help.




Reply With Quote