Click here to Skip to main content
15,909,530 members

Comments by Member 12338931 (Top 7 by date)

Member 12338931 1-Apr-20 21:09pm View    
That was it. Thank you very much.
Member 12338931 1-Apr-20 16:13pm View    
Thanks. I'm getting the following error in the values.Select ... line:

Error CS0266 Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<system.collections.generic.list<int>>' to 'System.Collections.Generic.List<system.collections.generic.list<int>>'. An explicit conversion exists (are you missing a cast?)

Google-ing/searching how to perform cast (if required). If you see if/what's causing the error, could you post response?

Yes, Dictionary might be better but I've got to return a List<List<int>>. Thanks.
Member 12338931 1-Apr-20 13:50pm View    
Also, the method must return a List<list<int>>.
Member 12338931 1-Apr-20 13:45pm View    
Yes, amount is a string in the JSON object but gets converted to an int when it's put into the list:

userAmount = Convert.ToInt32(Math.Floor(decimal.Parse(model.data[row].amount, System.Globalization.NumberStyles.Currency)));

As I've stated, I have a List<list<int>> userTxns composed of userId and amount pairs. The raw JSON might, for example, have 10 transactions in the data section from 4 users. I need to group by the user IDs then sum respective amounts. I'm looking at OriginalGriff's suggestion; if you have something helpful too, I'd love to hear it. Thank you.
Member 12338931 1-Apr-20 13:40pm View    
So in your example, are all the example log files in the rawFiles object as in

Dictionary<string, list<string="">> groups = rawFiles.GroupBy(r => GetDateFromPath(r)).ToDictionary(g => g.Key, g => g.ToList());