我正在尝试使用 memorystream(在 ASP.NET 4.0 中)创建一个 ICS 日历文件,如下所示:
using System.IO;
using System;
public MemoryStream GetMemoryStream()
{
iCalendar iCal = new iCalendar();
Event evt = iCal.Create<Event>();
// Set information about the event
evt.Start = new iCalDateTime(SomeStartTime);
evt.End = new iCalDateTime(SomeEndTime);
evt.Location = SomeLocation;
evt.Description = SomeDescription;
evt.Summary = SomeSummary;
iCalendarSerializer serializer = new iCalendarSerializer(iCal);
MemoryStream ms = new MemoryStream();
serializer.Serialize(iCal, ms, Encoding.UTF8);
return ms;
}
我想我错过了一些东西。任何人都可以帮我创建正确MemoryStream
的对象吗?
注意:我需要该MemorySteam
对象来创建一个System.Net.Mail.Attachment
for System.Net.Mail.MailMessage
。