Answer the question
In order to leave comments, you need to log in
How to work with a large number of tables?
Kind time of day, there was a task to compare some tables. In such a way that it would be possible to understand where the products coincide and get their difference.
- What is the best to use? json, dictionaries, etc.
- What is the best logic to organize? the speed of work is also important
Auchan store:
1. Bread: retail = 2; wholesale=1
2. Cheese: retail=4; wholesale=2.5
3. Milk: retail=3; wholesale=2
Shop Green:
1. Bread: retail=2.3; wholesale=1.5
2. Flour: retail=4.2; wholesale=2.7
3. Sausage: retail=2.8; wholesale = 1.8;
Shop City:
1. Flour: retail = 2.2; wholesale=1.3
2. Bread: retail=4; wholesale=3
3. Cheese: retail=3.4; wholesale = 1.9
Result!
Bread:
ashan city: retail=2; wholesale=2
green city: retail=1.7; wholesale=1.5
Auchan-green: retail=0.3; wholesale=0.5
Answer the question
In order to leave comments, you need to log in
Making a class:
class Entry {
string StoreName;
string ProductName;
decimal RetailPrice;
decimal BulkPrice;
}
List<Entry> list;
//заполнение списка
var sorted = list.GroupBy(e => e.ProductName).ToDictionary(e => e.Key, e => e.OrderBy(k => k.RetailPrice).ToArray());
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question