如何在子查询中引用JToken集合中的所有元素 [英] How can I reference all elements in the JToken collection in a subquery

查看:374
本文介绍了如何在子查询中引用JToken集合中的所有元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个方法(CSOM Sharepoint Taxonomy相关),它根据某个参数返回子查询集合中的某些元素

I have a method (CSOM Sharepoint Taxonomy related) that returns certain elements from subquery collection based on a certain parameter


目前它只返回集合中的第一个元素或最后一个元素;但是,我想返回所有元素,包括第一个和最后一个

Currently it returns only first element from the collection or the last element; however, I would like to return all elements including first and the last


我不想改变代码的结构,只是想修改它保持LINQ格式

I don't want to change the structure of the code, just want to modify it keeping the LINQ format


请告诉我如何才能正式完成

Please let me know how it could be done officially


非常感谢

    public List<JToken> GetSubTermsByTermName(string type, string termName)
    {
        var termSetTerms =
            from t in Terms
            where (string)t["type"].First == type
            select t;

        var rootTerms = termSetTerms.Where(t =>

        termSetTerms.Any(u =>
            ((string)u["label"] == (string)t["sub_class_of"].First["label"]
                && (string)t["sub_class_of"].First["label"] == termName)  ||
            ((string)u["label"] == (string)t["sub_class_of"].Last["label"]
                && (string)t["sub_class_of"].Last["label"] == termName)));

        return rootTerms.ToList<JToken>();
    }





推荐答案

嗨詹姆斯,

谢谢伸出来!

然而,这似乎是一个与股票相关的问题。

However this seems to be a sharepoint related question.

你能尝试将线程移动到:

Can you try moving the thread to:

https://social.msdn.microsoft.com/Forums / office / en-US / home?category = sharepoint

谢谢!


这篇关于如何在子查询中引用JToken集合中的所有元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆