convert Tag object to Array ?

  • Thread starter Thread starter Bill Woodruff
  • Start date Start date
B

Bill Woodruff

Really a theoretical question out of curiousity more
than a truly practical one ... I seem to recall that
casting arrays was a no-no in C++.

I think it is not possible to take an array in a Tag object :

// put an array in a UserControl's Tag object
myUserControl.Tag = new int[3,4];

And then extract it and typecast it back to an array.

But it is interesting that if you set a breakpoint and then
go into the command window and inspect the value :

? myUserControl.Tag

It reports its Type as System. Array.

Any thoughts ?

thanks, Bill Woodruff
dotScience
Chiang Mai, Thailand
 
Really a theoretical question out of curiousity more
than a truly practical one ... I seem to recall that
casting arrays was a no-no in C++.

I think it is not possible to take an array in a Tag object :

// put an array in a UserControl's Tag object
myUserControl.Tag = new int[3,4];

And then extract it and typecast it back to an array.

But it is interesting that if you set a breakpoint and then
go into the command window and inspect the value :

? myUserControl.Tag

It reports its Type as System. Array.

Any thoughts ?

Yup, just cast it:

int[,] foo = (int[,]) myUserControl.Tag;

That should be absolutely fine.
 
Back
Top