Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/334.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Umbraco/基地扩建工程_C#_Linq_Umbraco - Fatal编程技术网

C# Umbraco/基地扩建工程

C# Umbraco/基地扩建工程,c#,linq,umbraco,C#,Linq,Umbraco,我正在为/base编写rest扩展。 我有以下代码: using System; using System.Collections.Generic; using System.Linq; using System.Text; using umbraco.presentation.umbracobase; using umbraco.NodeFactory; namespace ElkeslasiBase { [RestExtension("Collections")] publ

我正在为/base编写rest扩展。 我有以下代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using umbraco.presentation.umbracobase;
using umbraco.NodeFactory;

namespace ElkeslasiBase
{
    [RestExtension("Collections")]
    public class Collection
    {
        [RestExtensionMethod()]
        public static string GetCollection(string collectionID)
        {
            var currentNode = Node.GetCurrent();
            var SelectedCollection = currentNode.ChildrenAsList.Where(elm => elm.Name == collectionID);
            return collectionID;
        }
    }
}
问题是编译器抛出lambda表达式的错误

Delegate 'System.Func<umbraco.interfaces.INode,int,bool>' does not take 1 argument
委托“System.Func”不接受1个参数

通过在谷歌的搜索,我发现有几个人正是这么做的。也许我错过了一份推荐信?或者其他什么?

我终于在某处找到了一个更新的示例。linq代码应该如下所示:

Node SelectedCollection = currentNode.Children.OfType<Node>().Where(elm => elm.Name == collectionID).SingleOrDefault();
Node SelectedCollection=currentNode.Children.OfType().Where(elm=>elm.Name==collectionID.SingleOrDefault();
那是我生命中的三个小时我再也回不来了