从列表中以所需格式读取数据

时间:2019-04-30 14:19:43

标签: c#

有人可以帮我吗,我不知道我缺少哪一部分,而我在“ sb”中读取的所有数据只是一个显示。

具体来说,我想从到达时刻一直获取EventToolTipText

目前,我从列表类型中仅获得一个数据:

  

冯:08:00:00二进制:12:00:00,

,我应该打印所有数据类型:

  

冯:08:00:00二进制:12:00:00,
  冯:12:00:00二进制:14:00:00,
  冯:14:00:00 bis:18:00:00,

这是我的代码:

CustomEvent cevent = null;
                        StringBuilder sb = new StringBuilder();
                        for (int n = 0; n < arrivals.Count; n++)
                        {

                            sb.AppendFormat("Von: {0} Bis: {1} \n", arrivals[n].ZPZ_Von.TimeOfDay, arrivals[n].ZPZ_Bis.TimeOfDay);

                            cevent = new Calendar.NET.CustomEvent()
                            {
                                IgnoreTimeComponent = true,
                                Date = arrivalDates[i],
                                EventText = c + new DateTime(1989, 1, 1, workingHours.Hours, workingHours.Minutes, workingHours.Seconds).ToString("HH:mm:ss") + "\n" + error,
                                EventColor = Color.Red,
                                EventToolTipText = sb.ToString()
                                };

                            if (!generatedEvents.Any(x => x.Date == cevent.Date))
                            {
                                calendar1.AddEvent(cevent);
                                generatedEvents.Add(cevent);

                            }
                        }

0 个答案:

没有答案