相关疑难解决方法(0)

vb.net中的lambda表达式

我有些东西让我绝对疯狂......

    Public Function GetAccountGroups() As IList(Of AccountGroup)
        Dim raw_account_groups As IList(Of AccountGroup)
        raw_account_groups = _repository.GetAccountGroups().ToList()
        Dim parents = (From ag In raw_account_groups _
                      Where ag.parent_id = 0 _
                      Select ag).ToList()

        parents(0).sub_account_groups = (From sag In raw_account_groups _
                               Where sag.parent_id = 0 _
                                Select sag).ToList()

        Dim sql_func As Func(Of AccountGroup, List(Of AccountGroup)) = Function(p) _
                                                                      (From sag In raw_account_groups _
                                                                       Where sag.parent_id = p.id _
                                                                       Select sag).ToList()

        parents.ForEach(Function(p) p.sub_account_groups = sql_func(p))

        Return parents
    End Function
Run Code Online (Sandbox Code Playgroud)

行"parents.ForEach(Function(p)p.sub_account_groups = sql_func(p))"出现此错误...

没有为类型'System.Collections.Generic.IList(Of st.data.AccountGroup)'和'System.Collections.Generic.List(Of st.data.AccountGroup)'定义Operator'='. …

linq vb.net

5
推荐指数
3
解决办法
1万
查看次数

标签 统计

linq ×1

vb.net ×1