NOTICE: I do not want do wrap the index of the array, in fact, I already did that. I also want to wrap the individual values of the array when they are set.
I am trying to get array values to automatically wrap around without using a for loop to do it, because I have a fairly large array (uint16 limit).
I was trying to use a get/set and use a simple wrap code if it is above the max or below the minimum.
Is there any way I can do this?
What I want:
MyArray[0] = 5
//MyArray's max is 3, and minimum is 0
Outcome:
MyArray[0] = 2
The problem is not looping around indices, but instead to have the values reduced to a limited range.
I've seen how to implement indexer - like Example of Indexer and how to clamp value - Where can I find the "clamp" function in .NET? (some even were suggested as duplicates).