public static Complex Div(Complex a, Complex b) { double eps = 1e-10; if (Modul(b) < eps) { var newZeroEvent = new ComplexDivisionEventArgs(a, b); a.ComplexDivisionEventHandler?.Invoke(a, newZeroEvent); } return(new Complex((a._real * b._real + a._imag * b._imag) / (b._real * b._real + b._imag * b._imag), (a._imag * b._real - a._real * b._imag) / (b._real * b._real + b._imag * b._imag))); }
public static void Func(object obj, ComplexDivisionEventArgs args) { Console.WriteLine(args.Divider.ToString()); throw new DivideByZeroException("Divide by zero"); }