I am trying to do a simple data series test andeverything is working as intended, but I want to switch
List<DateTime> events = new List<DateTime>();
to
List<dynamic> events = new List<dynamic>();
When I switch the list to dynamic I am getting these 2 errors. "One or more types required to compile dynamic expression cannot be found. Are you missing a reference?" and these two errors are occuring on the Console.Writeline
Any idea how I can output the List with dynamic?
Here's my code:
[TestMethod]
public void TimeSeriesData()
{
List<dynamic> events = new List<dynamic>();
var stream = new
{
Id = 15,
Name = "StreamA" + 15,
TypeId = "TypeA"
};
_server.PostStream(stream);
DateTime startTime = DateTime.Today; // 12:00
DateTime endTime = DateTime.Today; // 12:00 +1 sec
endTime = endTime.AddDays(1);
endTime=endTime.AddSeconds(1);
for (int i = 0; i < 3000; i++)
{
if (i % 2 == 0) //is even
{
var dataStart = new
{
TimeId = startTime.AddSeconds(i),
ValueStart = i
};
events.Add(startTime.AddSeconds(i));
}
else //is odd
{
var dataEnd = new
{
TimeEnd = endTime.AddSeconds(-i),
ValueEnd = i
};
events.Add(endTime.AddSeconds(-i));
}
}
foreach (var item in events)
Console.WriteLine("Time: {0} ", item.ToString());
}