मैं कुछ है कि मुझे बिल्कुल पागल गाड़ी चला रहा है ...लैम्ब्डा भाव
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
लाइन "parents.ForEach (फंक्शन (पी) p.sub_account_groups = sql_func (पी))" है यह त्रुटि ...
ऑपरेटर '=' प्रकारों के लिए परिभाषित नहीं किया गया है 'System.Collections.Generic.IList (st.data.AccountGroup)' और 'System.Collections.Generic.List (st.data का। AccountGroup) '।
लेकिन मैं वास्तव में नहीं देख सकते हैं कि यह कैसे रोब कॉनरी
public IList<Category> GetCategories() {
IList<Category> rawCategories = _repository.GetCategories().ToList(); var parents = (from c in rawCategories
where c.ParentID == 0
select c).ToList();
parents.ForEach(p =>
{
p.SubCategories = (from subs in rawCategories
where subs.ParentID == p.ID
select subs).ToList();
});
return parents;
}
जो पूरी तरह से संकलित से इस कोड से किसी भी तरह से अलग है ... मैं गलत तरीके से क्या कर रहा हूँ?
"लैम्बाडा अभिव्यक्ति" - lol :) –
यह वर्जित कोड है! –
निषिद्ध कोड? मैंने सोचा कि रूबी था? – GEOCHET