Use Struct as a Ptr/class? Need a fix .NET
Posted
by acidzombie24
on Stack Overflow
See other posts from Stack Overflow
or by acidzombie24
Published on 2010-05-10T00:55:18Z
Indexed on
2010/05/10
0:58 UTC
Read the original article
Hit count: 293
I wrote a bunch of code and i would like to fix it the fastest way possible. I'll describe my problem in a easier way.
I have apples and oranges, they are both Point and in the list apples, oranges. I create a PictureBox and draw the apple/oranges on screen and move them around and update the Point via Tag.
The problem now is since its a struct the tag is a copy so the original elements in the list are not update. So, how do i update them? I consider using Point? But those seem to be readonly. So the only solution i can think of is
- Clear the list, iterate through all the controls then check the picturebox property to check if the image is a apple or orange then add it to a list
I really only thought of this solution typing this question, but my main question is, is there a better way? Is there some List<Ptr<Point>>
class i can use so when i update the apples or oranges through the tag the element in the list will update as a class would?
© Stack Overflow or respective owner