Am 16.10.2013 16:08, schrieb Benjamin Thaut:
Am 16.10.2013 10:40, schrieb DoctorCaptain:
http://dpaste.dzfl.pl/07b20d75
Note the use of typeof() to get the type of the elements at each index
of members, to generate a type on which a constructor can be called to
instantiate the elements at each index of members. Magic.
There is actually a easier way to instanciate the elements. Just do "new
T[i]();" no need for typeof.
I'm actually wrong. "new T[i]()" will not work because the compiler will
think it is a array allocation. You actually have to use new
typeof(member[i])();
I created a example which generates individual class members for each of
the arguments bassed to GrabBagT:
http://dpaste.dzfl.pl/eef2edec
--
Kind Regards
Benjamin Thaut