本文整理汇总了C#中GLib.List.Count方法的典型用法代码示例。如果您正苦于以下问题:C# List.Count方法的具体用法?C# List.Count怎么用?C# List.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLib.List
的用法示例。
在下文中一共展示了List.Count方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateDesktopItemsList
void UpdateDesktopItemsList ()
{
if (RegisteredItems == null)
RegisteredItems = new List<DesktopItem> ();
List<DesktopItem> newItems = new List<DesktopItem> ();
IEnumerable<DesktopItem> knownItems = DesktopItems;
// Get desktop items for new "valid" desktop files
newItems = DesktopFileDirectories
.SelectMany (dir => dir.SubDirs ())
.Union (DesktopFileDirectories)
.SelectMany (dir => dir.GetFiles (".desktop"))
.Where (file => !knownItems.Any (existing => existing.File.Path == file.Path))
.Select (file => new DesktopItem (file))
.ToList ();
RegisteredItems.AddRange (newItems);
if (newItems.Count () > 0) {
Log<DesktopItemService>.Debug ("{0} new application(s) found.", newItems.Count ());
foreach (DesktopItem item in newItems)
Log<DesktopItemService>.Debug ("Adding '{0}'.", item.Path);
}
// Check file existence and remove unlinked items
List<DesktopItem> removeItems = RegisteredItems.Where (item => !item.File.Exists).ToList ();
if (removeItems.Count > 0) {
removeItems.ForEach (item => {
RegisteredItems.Remove (item);
item.Dispose ();
});
Log<DesktopItemService>.Debug ("{0} application(s) removed.", removeItems.Count);
}
}