Reputation: 21260
How I can convert this code to LINQ?
var TcData = new List<double>(); for(int i=0;i< numberTcs ;++i) { TcData.Add(-1); }
Upvotes: 3
Views: 141
Reputation: 178630
TcData = Enumerable.Repeat(-1d, numberTcs).ToList();
Upvotes: 7
Reputation: 34407
TcData = new List<double>(Enumerable.Repeat<double>(-1, numberTcs));
Upvotes: 2