Enumerable.Range.
The Console.WriteLinq query call is somewhat unusual since it does not return a value.
You can build the string first and then print it i, e:
var result = String.Join("\n", Enumerable.Range(1,10).Select(i=> i.ToString()));
Or use ForEachforList
Enumerable.Range(1,10).ToList().ForEach(Console.WriteLine)
Or return the value with the call WriteLineto Select:
Enumerable.Range(1,10).Select(i => { Console.WriteLine(i); return 0;});
source
share