CSharp - Generating and Using a Repeating Sequence

Description

Generating and Using a Repeating Sequence

Demo

using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

class Program/*from w  ww  . j  av a 2  s . co m*/
{
    static void Main(string[] args)
    {
    
           int sum = ParallelEnumerable.Repeat(1, 50000)
               .Select(i => i)
               .Sum();
    
           Console.WriteLine("Sum: {0}", sum);
    }
}

Result

Related Topic