15,909,530 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
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());
Member 12338931
1-Apr-20 13:31pm
View
Thanks ... I'll see if I can figure out how to implement this...
Member 12338931
1-Apr-20 13:19pm
View
I'm trying to group by userId in the userTxns object which contains lists of userIDs and amounts.
The output should group userIds and sum each user's amounts like this:
1 1000
2 2000
3 3000
4 4000
where the first column is the userId and the second column is each respective user's summed amounts.
Show More