uses Repeat to generate a sequence that contains the number 7 ten times. : Enumerable.Repeat « LINQ « C# / C Sharp






uses Repeat to generate a sequence that contains the number 7 ten times.

 

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

public class MainClass {
    public static void Main() {
        var numbers = Enumerable.Repeat(7, 10);

        foreach (var n in numbers) {
            Console.WriteLine(n);
        }
    }
}

 








Related examples in the same category

1.Returning a Sequence of Ten Integers All With the Value Two