本文整理汇总了C#中Speaker.AddSession方法的典型用法代码示例。如果您正苦于以下问题:C# Speaker.AddSession方法的具体用法?C# Speaker.AddSession怎么用?C# Speaker.AddSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Speaker
的用法示例。
在下文中一共展示了Speaker.AddSession方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSpeakerSessions
public IEnumerable<Speaker> GetSpeakerSessions()
{
List<Speaker> speakers = new List<Speaker>();
//var obj = ServiceStack.Text.CsvSerializer.DeserializeFromStream(typeof(object), File.Open(_filePath, FileMode.OpenOrCreate));
var dataTable = CsvToDataTable(_filePath);
//var dataTable = CSVParser.ParseCSV(_filePath);// CSVReader.ReadCSVFile(_filePath, true);
//var dataTable = new DataTable();
foreach (DataRow row in dataTable.Rows)
{
var speaker = new Speaker
{
Name = row["Speaker Name"].ToString(),
HomeTown = row["City, State"].ToString(),
Email = row["Email Address"].ToString(),
Website = row["Website or Blog URL"].ToString(),
HeadshotUrl = row["URL for a 90x117 pixel JPG headshot image of you"].ToString(),
Bio = row["Speaker Bio"].ToString(),
NotesToOrganizer = row["Other notes about yourself or your submission"].ToString(),
};
var session1 = new Session
{
Level = row["Session 1 - Level"].ToString(),
Title = row["Session 1 - Title"].ToString(),
Description = row["Session 1 - Description"].ToString(),
};
var session2 = new Session
{
Level = row["Session 2 - Level"].ToString(),
Title = row["Session 2 - Title"].ToString(),
Description = row["Session 2 - Description"].ToString(),
};
var session3 = new Session
{
Level = row["Session 3 - Level"].ToString(),
Title = row["Session 3 - Title"].ToString(),
Description = row["Session 3 - Description"].ToString(),
};
if (!string.IsNullOrWhiteSpace(session1.Title))
speaker.AddSession(session1);
if (!string.IsNullOrWhiteSpace(session2.Title))
speaker.AddSession(session2);
if (!string.IsNullOrWhiteSpace(session3.Title))
speaker.AddSession(session3);
speakers.Add(speaker);
}
return speakers;
}