Click to See Complete Forum and Search --> : adding points to ArrayList


kkirtac
December 7th, 2005, 03:43 PM
i m trying to add points to ArrayList, i m using Point class' objects to be added, but i receive an error 'errorC2664:cannot convert parameter1 from System::Drawing::Point __gc* to System::Object __gc*' ; what can i do? any help is appreciated, thanks

NoHero
December 7th, 2005, 04:38 PM
Well... any managed type derives from System::Object* thus it should not be a problem at all. But try dynamic_cast:

myArrayList->Add(dynamic_cast<System::Object*>(myPoint));

kkirtac
December 7th, 2005, 05:16 PM
thanks, i tried boxing and it worked out

NoHero
December 7th, 2005, 05:34 PM
thanks, i tried boxing and it worked out

Ohh... I missed that Points are value types... ;)