Home > Net >  Turn on the calculation of values within the list
Turn on the calculation of values within the list

Time:05-13

Suppose list Data for the
CodeA CodeB Amount
1200 2000 1000
2000 1000 500
1500 3000 1000

The calculated results for the
CodeA CodeB Amount
1200 2000 500
1500 3000 1000

Which appears codeA equals CodeB
Two rows of data consolidation, the Amount is equal to the large Amount minus the small Amount
At the same time keeping large Amount codeA and codeB
If there is no do not calculate, retain the original data directly,

For help how to implement

CodePudding user response:

Use figure or list more appropriate,

Of course, for your problem, we must first discuss limitations, that is how much we need recursive layer, is how to deal with "ring"

For example,

CodeA CodeB Amount
1200 2000 1000
2000 1000 500
, 1000, 2500, 500//-- -- -- -- -- -- -- -- -- -- - 1000 there are 2500, so how to calculate the
2500, 1200, 2000 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- clearly pointed to the 1200 data from the new, the data ring

So before we answer this question, you'd better define "two rows of data merging" rule

CodePudding user response:

Using the database of terms: since the link

There are SelectMany
The form in the select
To choose

  •  Tags:  
  • C#
  • Related