LinqPad ToIntervalSttream seems to create a PointStream

已答覆 LinqPad ToIntervalSttream seems to create a PointStream

  • jueves, 26 de enero de 2012 13:33
     
     

    I don't know if what I am seeing is just a bug in LinqPad or not but this is what is happening.

    With the code shown below, I expect to see, in my dumped output, events that look like interval events but what I actually see is point events (see below the code snippet)

     Func<int, int, DateTime> dt = (i,j) => new DateTime(2011, 12, 1, 13, i, j, DateTimeKind.Utc);

     var input = new[]
     {
      new {start=dt(1,30),  end=dt(3,30), ID = "A" },
      new {start=dt(3,30),  end=dt(7,30), ID = "A" }
     };
     
     var inputStream = input.ToIntervalStream(Application, 
     e => IntervalEvent.CreateInsert(e.start, e.end, new {e.ID}),
     AdvanceTimeSettings.IncreasingStartTime);
     
     inputStream.Dump();

     

    This is what I get: 

    PointEvent<>
    EventKind

    Insert

    StartTime

    12/1/2011 1:01:30 PM

    Payload
    { ID = A }
    ID

    A

    PointEvent<>
    EventKind

    Insert

    StartTime

    12/1/2011 1:03:30 PM

    Payload
    { ID = A }
    ID

    A

Todas las respuestas

  • jueves, 26 de enero de 2012 15:37
     
     Respondida

    Found the answer

    Instead of

         inputStream.Dump();

    use

         inputStream.ToIntervalEnumerable().Dump();

     

    • Marcado como respuesta FarnhamSurrey miércoles, 01 de febrero de 2012 17:36
    •