estoy en el proceso de enseñar a mí C# mediante la conversión de un proyecto existente y estoy atascado convertir el siguiente código vb LINQ:conversión de VB LINQ a C#
Dim outStuff = From tt In (From t In Products.SelectMany(Function(p) If(p.tags IsNot Nothing, p.tags, New ObservableCollection(Of TagModel)))
Group By tagName = t.name,
v = (Aggregate p In Products Where If(p.tags IsNot Nothing, p.tags.Contains(t), Nothing) Into Sum(p.views)),
nl = (Aggregate p In Products Where If(p.tags IsNot Nothing, p.tags.Contains(t), Nothing) Into Sum(p.num_likes))
Into g = Group, Count())
Group By name = tt.tagName Into Count = Sum(tt.Count), viewsTotal = Sum(tt.v), num_likesTotal = Sum(tt.nl)
Select name, Count, viewsTotal, num_likesTotal
donde Products As ObservableCollection(Of ProductModel)
He mananged para convertir esto hasta ahora:
var x = Products.SelectMany(p => (p.tags != null) ? p.tags : new ObservableCollection<TagModel>());
var tags = from t in x group t by t.name into g select new { tagname=g.First().name};
El 'Grupo By me tiene perplejo. Cualquier ayuda sería grande ...
Si se ayuda a nadie, aquí está el proyecto que pertenece el código que estoy tratando de convertir y añadir a la página: http: // www .codeproject.com/KB/silverlight/ListDragDropSL.aspx – Graeme