public void ComputeSum()
        {
            int sum = 0;

            for (int i = 0; i < _target; i++)
            {
                sum += i;
            }
            _sumdel?.Invoke(sum);//if del is not null//if it is assigned to someone//Invoke the delegate passing interger value sum
        }
Ejemplo n.º 2
0
        public void PrintSumOfNumbers()
        {
            int sum = _target;

            for (int i = 1; i < _target; i++)
            {
                sum = sum + i;
            }

            _callBackMethod?.Invoke(sum);
        }