I have had a hard time searching for the answer to my problem because it always comes up with indexing the class itself, and not the array as a field of the class. I assume the answer is simple, but I am confused by it and not sure what to do.
So here is my problem:
I am setting the Arrays to the proper size in the contructor.Code:private PointF[] inputArray; public PointF[] InputArray { get { return inputArray; } set { AdjustedArray = translatePoint(value); inputArray = value; } } public PointF[] AdjustedArray; private PointF translatePoint(PointF point) { Do stuff return translatedPointF; }
So I have an array as part of my class and I want to adjust the values as I pass them to the array. It would be nice to do this in the set{}.
The problem is that I don't understand how it knows what index is being passed to it and how I can pass that index to the adjusted array. If I take the AdjustedArray line out of the set{}, I can access the array no problem. . . but that then requires me to explicitly adjust the AdjustedArray from outside of the class and it seems like it would be a better idea to adjust it from within the class. . . especially considering I want every point adjusted.
Right now, this bit of code will not compile.
So how do I pass the index that was passed to the InputArray? Or am I thinking about this all wrong?



LinkBack URL
About LinkBacks


