G
Guest
Hi
Have these to work with.
int counter = 0; //The total item to fill the collection with
int increment = 2; //Any number
int current = 244; //Quantity
int max = 1290; //Max Quantity
int min = 0; //Min Quantity, is 0 or the increment value
List<int> list = new List<int>(); //A simple collection
What I wanna do is to fill list with the 10 closest values to the current
value.
E.g:
If current is 144 and increment is 2. list should then contain:
134, 136, 138, 140, 142, [144], 146, 148, 150, 152, 154
If current is 4 and increment is 2. list should then contain:
2, [4], 6, 8, 10, 12, 14, 16, 18, 20, 22
The value can not be less then min or more then max.
If current is 144 and increment is and max is 150. list should then contain:
130, 132, 134, 136, 138, 140, 142, [144], 146, 148, 150
If current is 144 and increment is and min is 140 and max is 150. list
should then contain:
140, 142, [144], 146, 148, 150
Have these to work with.
int counter = 0; //The total item to fill the collection with
int increment = 2; //Any number
int current = 244; //Quantity
int max = 1290; //Max Quantity
int min = 0; //Min Quantity, is 0 or the increment value
List<int> list = new List<int>(); //A simple collection
What I wanna do is to fill list with the 10 closest values to the current
value.
E.g:
If current is 144 and increment is 2. list should then contain:
134, 136, 138, 140, 142, [144], 146, 148, 150, 152, 154
If current is 4 and increment is 2. list should then contain:
2, [4], 6, 8, 10, 12, 14, 16, 18, 20, 22
The value can not be less then min or more then max.
If current is 144 and increment is and max is 150. list should then contain:
130, 132, 134, 136, 138, 140, 142, [144], 146, 148, 150
If current is 144 and increment is and min is 140 and max is 150. list
should then contain:
140, 142, [144], 146, 148, 150