本文整理汇总了C#中Data.List.Single方法的典型用法代码示例。如果您正苦于以下问题:C# List.Single方法的具体用法?C# List.Single怎么用?C# List.Single使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data.List
的用法示例。
在下文中一共展示了List.Single方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Deal
public Deal(List<Player> players, Player dealer)
{
Players = players;
Players.Select(p => p.Role = null);
Dealer = Players.Single(p => p.Name == dealer.Name);
Dealer.Role = CreateRole(players);
}
示例2: GetEssayCategories
public List<Category> GetEssayCategories()
{
var categories = new List<Category>();
foreach (var essayDictItem in essaysDictionary)
{
if (!categories.Exists(e => e.Name == essayDictItem.Value.Category))
{
categories.Add(new Category(essayDictItem.Value.Category));
}
categories.Single(e => e.Name == essayDictItem.Value.Category).EssaysForCategory.Add(
new EssayForCategory(essayDictItem.Value.Title, essayDictItem.Key, essayDictItem.Value.PublishInfo.OriginalPublishDate));
}
categories.ForEach(c => c.EssaysForCategory = c.EssaysForCategory.OrderByDescending(e => e.PublishDate).ToList());
return categories;
}
示例3: GetEssayYears
public List<Year> GetEssayYears()
{
var years = new List<Year>();
foreach (var essayDictItem in essaysDictionary)
{
if (!years.Exists(e => e.YearValue == essayDictItem.Value.PublishYear))
{
years.Add(new Year(essayDictItem.Value.PublishYear));
}
years.Single(e => e.YearValue == essayDictItem.Value.PublishYear).EssaysForYear.Add(
new EssayForYear(essayDictItem.Value.Title, essayDictItem.Key, essayDictItem.Value.Category, essayDictItem.Value.PublishInfo.OriginalPublishDate));
}
years.ForEach(c => c.EssaysForYear = c.EssaysForYear.OrderByDescending(e => e.PublishDate).ToList());
return years.OrderByDescending(y => y.YearValue).ToList();
}