public static async void calculateTables(List <Polinom> columns, Order order, Polinom IrreduciblePolinom, Action <Polinom, int, int> summationCallback, Action <Polinom, int, int> multiplicationCallback, Action finalCallback) { int calcSize = (int)Math.Pow(order.Mantissa, order.Exponent); for (int i = 0; i < calcSize; i++) { Polinom rowPolinom = columns[i]; for (int j = 0; j < calcSize; j++) { Polinom colPolinom = columns[j]; Polinom summationRes = await Task.Run <Polinom>(() => { return(Polinom.calcPolinomToZp((rowPolinom + colPolinom) % IrreduciblePolinom, order.Mantissa)); }); summationCallback(summationRes, i, j); Polinom multiplicationRes = await Task.Run <Polinom>(() => { return(Polinom.calcPolinomToZp((rowPolinom * colPolinom) % IrreduciblePolinom, order.Mantissa)); }); multiplicationCallback(multiplicationRes, i, j); } } finalCallback(); }