本文整理汇总了C#中Newtonsoft.Json.Linq.JArray.Where方法的典型用法代码示例。如果您正苦于以下问题:C# JArray.Where方法的具体用法?C# JArray.Where怎么用?C# JArray.Where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Newtonsoft.Json.Linq.JArray
的用法示例。
在下文中一共展示了JArray.Where方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddChildren
private void AddChildren(ElementHost element, JArray elements)
{
element.Children.Clear();
var children = elements.Where(x => x["parentId"]?.ToString() == element.Id)
.Select(x => WebElement.Create(x, this, element));
element.Children.AddRange(children);
foreach (var child in element.Children)
{
AddChildren(child, elements);
}
}
示例2: SetCommentCounts
private static void SetCommentCounts(JArray whatsThis, List<IGrouping<string, LogEntry>> tmp)
{
if (whatsThis != null)
{
foreach (var log in tmp)
{
var logComCnt = whatsThis.Where(x => x.Value<string>("Key") == log.Key);
var firstOrDefault = logComCnt.FirstOrDefault();
if (firstOrDefault != null)
log.First().CommentCount = firstOrDefault.Value<int>("Value");
}
}
}
示例3: GetCategoriesFromJArray
private List<Category> GetCategoriesFromJArray(Category parentCategory, JArray array, bool getGenres)
{
List<Category> categories = new List<Category>();
foreach (JToken element in array.Where(e => (!getGenres && e["isGenre"].Value<string>() != "genre" && !e["url"].Value<string>().StartsWith("/video/")) || (getGenres && e["isGenre"].Value<string>() == "genre")))
{
RssLink category = new RssLink()
{
Name = element["title"].Value<string>(),
Thumb = element["thumbnail"].Value<string>(),
Url = element["url"].Value<string>().Replace("genre/", "").Replace("/", ""),
ParentCategory = parentCategory,
SubCategories = new List<Category>(),
HasSubCategories = true
};
category.Thumb = (category.Thumb.StartsWith("/") ? string.Concat("http://www.svtplay.se", category.Thumb) : category.Thumb);
category.Other = (getGenres ? (Func<List<Category>>)(() => GetTagCategories(category)) : (Func<List<Category>>)(() => GetProgramCategoriesAndVideos(category)));
categories.Add(category);
}
categories = categories.OrderBy(c => c.Name).ToList<Category>();
return categories;
}