I have some class that's managing the user interface - CMan, and I'm passing it the struct array with some txtboxes in it. CMan than changes txtboxes.
This struct is initialized like this:
Expand|Select|Wrap|Line Numbers
- struct STxt { public TextBox data1; public TextBox data2;};
- STxt [] myArray;
- myArray = new STxt[10];
- myArray[0].data1 = txtFirstBox; //txtFirstBox is a TextBox
- myArray[1].data1 = txtSecondBox;
- //...
- CMan handler = new CMan(myArray);
Expand|Select|Wrap|Line Numbers
- txtFirstBox.Text = "Sample text";
- handler.TxtArray[0].data1.Text = "Changed text";
(I guess I can solve it by using unsafe code via pointers, but I'd like to avoid this if possible)