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

image_pdfimage_print
   
 

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);
        }
    }
}

    


This entry was posted in LINQ. Bookmark the permalink.