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 www.j  a  va  2s  . c  o  m*/
{
    static void Main(string[] args)
    {
    
           int sum = ParallelEnumerable.Repeat(1, 50000)
               .Select(i => i)
               .Sum();
    
           Console.WriteLine("Sum: {0}", sum);
    }
}

Result

Related Topic