当前位置: 首页>>代码示例>>C#>>正文


C# LinkedList.FirstOrDefault方法代码示例

本文整理汇总了C#中LinkedList.FirstOrDefault方法的典型用法代码示例。如果您正苦于以下问题:C# LinkedList.FirstOrDefault方法的具体用法?C# LinkedList.FirstOrDefault怎么用?C# LinkedList.FirstOrDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LinkedList的用法示例。


在下文中一共展示了LinkedList.FirstOrDefault方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DequeueFreeChild

 private static QueueElement DequeueFreeChild(LinkedList<QueueElement> childrenQueue, QueueElement parentNode, int precedents)
 {
     QueueElement freeChild = childrenQueue
         .FirstOrDefault(childNode =>
             parentNode.Edges.Count(_ => _ == childNode.Node) <= 0);
     if (freeChild == null) return null;
     if (++freeChild.PrecedentCount == precedents)
         childrenQueue.Remove(freeChild);
     return freeChild;
 }
开发者ID:rexwhitten,项目名称:Orc.DependencyGraph,代码行数:10,代码来源:GraphGenerator.cs

示例2: TryGetManagedWindowForWorkspace

 public bool TryGetManagedWindowForWorkspace(IntPtr hWnd, Workspace workspace,
     out Window window, out LinkedList<Tuple<Workspace, Window>> list)
 {
     if (ApplicationsTryGetValue(hWnd, out list))
     {
         var tuple = list.FirstOrDefault(t => t.Item1 == workspace);
         if (tuple != null)
         {
             window = tuple.Item2;
             return true;
         }
     }
     window = null;
     return false;
 }
开发者ID:ryguasu,项目名称:windawesome,代码行数:15,代码来源:Windawesome.cs

示例3: GetCommandName

        public static string GetCommandName([NotNull, ItemNotNull] ref IEnumerable<string> args)
        {
            #region Sanity checks
            if (args == null) throw new ArgumentNullException(nameof(args));
            #endregion

            var arguments = new LinkedList<string>(args);
            string commandName = arguments.FirstOrDefault(argument => !argument.StartsWith("-") && !argument.StartsWith("/"));
            if (commandName != null) arguments.Remove(commandName);

            args = arguments;
            return commandName;
        }
开发者ID:0install,项目名称:0install-win,代码行数:13,代码来源:CommandFactory.cs

示例4: GetMessage

        private static IrcMessage GetMessage(string unparsedMessage, LinkedList<IrcMessage> potentialHandlers)
        {
            IrcMessage msg = potentialHandlers.FirstOrDefault(m => m.CanParse(unparsedMessage));
            if (msg != null)
            {
                // prioritize this IrcMessage by moving it to the beginning of the list
                if (msg != potentialHandlers.First.Value)
                {
                    potentialHandlers.Remove(msg);
                    potentialHandlers.AddFirst(msg);
                }

                // return a new instance of this message
                return (IrcMessage) Activator.CreateInstance(msg.GetType());
            }

            return null;
        }
开发者ID:alfaproject,项目名称:Supay.Irc,代码行数:18,代码来源:IrcMessageFactory.cs


注:本文中的LinkedList.FirstOrDefault方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。