Exemplo n.º 1
0
        //---------------------------------------------------------------------
        private static async ValueTask <double> Sink(DataPointIterator data, CancellationToken ct = default)
        {
            double sum   = 0;
            uint   count = 0;

            await foreach (DataPoint dp in data.WithCancellation(ct))
            {
                sum += dp.Y;

                if (count % (1 << 15) == 0)
                {
                    Console.WriteLine($"count: {count}, sum: {sum}");
                }
                count++;
            }

            return(sum);
        }