In Linq, how do convert Enumerable.Range(1, 31) to a List of strings?
var list = Enumerable.Range(1, 31).Select(n => n.ToString()).ToList();
static void Main(string[] args)
{
List<string> test;
test = Enumerable.Range(1, 31).Select(n => n.ToString()).ToList();
foreach (var item in test)
{
Console.WriteLine(item);
}
Console.ReadLine();
}
This one print 31 lines for me :).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With