我有一个,List<IOhlcv>我需要从:string[]DateTimeList
public interface ITick
{
DateTimeOffset DateTime { get; }
}
public interface IOhlcv : ITick
{
decimal Open { get; set; }
decimal High { get; set; }
decimal Low { get; set; }
decimal Close { get; set; }
decimal Volume { get; set; }
}
//candles is a List<IOhlcv>
var candles = await importer.ImportAsync("FB");
这里发生了什么?:
string[] x = from p in candles
orderby p.DateTime ascending
select What goes here?
我也可以得到这样List的:Datetime
var sd = candles.Select(i => i.DateTime).ToList();
有没有办法在List<DateTime> to a List<String>不循环的情况下转换?
我知道我可以做这样的事情,但我试图避免循环:
List<string> dateTimeStringList = new List<string>();
foreach (var d in candles)
dateTimeStringList.Add(d.DateTime.ToString());
return dateTimeStringList ;