linq Repeat

linq Repeat
This sample uses Repeat to generate a sequence that contains the number 8 ten times.
public static void Repeat()
        {
            var numbers = Enumerable.Repeat(8, 10);
            int i = 1;
            foreach (var n in numbers)
            {
                Console.WriteLine("Count {0} : {1}", i, n);
                i++;
            }
        }
Output

linq Repeat linq Repeat Reviewed by Bhaumik Patel on 4:10 AM Rating: 5