I have this scenario where I have to add the numbers inside a collection. An example would serve a best example.
I have these values in my database:
| Foo |
| 1 |
| 5 |
| 8 |
| 4 |
Result:
| Foo | Result |
| 1 | 1 |
| 5 | 6 |
| 8 | 14 |
| 4 | 18 |
As you can see, it has a somewhat fibonacci effect but the twist here is the numbers are given.
I can achieve this result with the help of for loop
but is this possible doing in Linq
. Like querying the database then having a result like above?
Any help would be much appreciated. Thanks!