本文整理汇总了C#中System.Collections.SortedList.Select方法的典型用法代码示例。如果您正苦于以下问题:C# SortedList.Select方法的具体用法?C# SortedList.Select怎么用?C# SortedList.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.SortedList
的用法示例。
在下文中一共展示了SortedList.Select方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RefreshFolderOverviewCache
private void RefreshFolderOverviewCache() {
//produce list sorted by episode number if we are a TV season
if (this.BaseItem is Season)
{
int unknown = 9999; //use this for episodes that don't have episode number
var items = new SortedList<int, BaseItem>();
foreach (BaseItem i in this.Folder.Children) {
Episode ep = i as Episode;
if (ep != null)
{
int epNum;
try
{
epNum = Convert.ToInt32(ep.EpisodeNumber);
}
catch { epNum = unknown++; }
try
{
items.Add(epNum, ep);
} catch {
//probably more than one episode coming up as "0"
items.Add(unknown++, ep);
}
}
}
folderOverviewCache = string.Join("\n", items.Select(i => (i.Value.Name)).ToArray());
}
else // normal folder
{
folderOverviewCache = string.Join("\n", folder.Children.OrderByDescending(i => i.DateCreated).Select(i => i.LongName).Take(Config.Instance.RecentItemCount).ToArray());
}
}
示例2: ParseView
//.........这里部分代码省略.........
memberData.Section = sectionIndex;
}
}
var viewTypes = GetViewTypes(memberData);
if (!sections.ContainsKey(memberData.Section))
{
var section = CreateSection(controller, memberData, viewTypes);
sections.Add(memberData.Section, section);
}
else
{
if (viewTypes != null)
{
IList<Type> list = null;
var key = memberData.Id.ToString();
var viewTypesList = sections[memberData.Section].ViewTypes;
if (viewTypesList.ContainsKey(key))
{
list = viewTypesList[key];
}
else
{
list = new List<Type>();
viewTypesList.Add(key, list);
}
foreach(var viewType in viewTypes)
{
if (!list.Contains(viewType))
{
list.Add(viewType);
}
}
}
}
if (memberLists.ContainsKey(memberData.Section))
{
memberLists[memberData.Section].Add(memberData.Order, memberData);
}
else
{
var sortedList = new SortedList<int, MemberData>();
sortedList.Add(memberData.Order, memberData);
memberLists.Add(memberData.Section, sortedList);
}
}
foreach(var kvp in memberLists)
{
var listSources = new SortedList<int, ListSource>();
var index = 0;
var list = kvp.Value.Values.ToList();
list.ForEach(data => data.Order = index++);
foreach(var memberData in list)
{
var viewTypes = GetViewTypes(memberData);
if ((!typeof(string).IsAssignableFrom(memberData.Type) && typeof(IEnumerable).IsAssignableFrom(memberData.Type)) || typeof(Enum).IsAssignableFrom(memberData.Type))
{
var listSource = ParseList(controller, memberData, viewTypes) as ListSource;
listSource.MemberData = memberData;
listSource.Sections[0].Index = memberData.Section;
listSources.Add(memberData.Order, listSource);
}
else
listSources.Add(memberData.Order, null);
sections[memberData.Section].ListSources = listSources;
sections[memberData.Section].Index = memberData.Section;
var lastListSource = listSources.Values.Last();
if (lastListSource != null)
memberData.DataContextBinder = new DataContextBinder(controller, lastListSource.Sections[0]);
}
sections[kvp.Key].DataContext = list;
}
var keyIndex = 0;
var sectionList = sections.Select(kvp => kvp.Value).ToDictionary((value) => keyIndex++);
// If there is only one list property return the ListSource rather than create a ViewSource
if (sectionList.Count == 1 && sectionList[0].DataContext.Count == 1 && sectionList[0].ListSources[0] != null && !sectionList[0].ListSources[0].IsRootCell)
{
sectionList[0].ListSources[0].TableViewStyle = UITableViewStyle.Plain;
return sectionList[0].ListSources[0];
}
var source = new ViewSource(controller) { Sections = sectionList };
return source;
}