I am trying to create a generic list of references to PointF
objects. (No, I am not looking to create a generic list of PointF
objects.) However, the following line fails to compile:
Generic::List<PointF^> ^pointList; // Generates error C3225
On the other hand, creating an array of PointF
references works without a problem as follows:
array<PointF^> ^points = gcnew array<PointF^>;
Here is a sample program:
using namespace System; using namespace System::Drawing; namespace Generic = System::Collections::Generic;
int main(array ^args) {
array ^points = gcnew array{ nullptr, PointF(0.0f, 0.0f), PointF(1.0f, 0.0f), nullptr };
Generic::List ^pointList; Console::WriteLine(L"Hello World"); return 0; }
How do I create a generic list of PointF
references? In other words, how do I create a generic list of boxed PointF
s?
Update: As an alternative, I could use Nullable<PointF>
but that still does not explain why array<PointF^>
compiles silently whereas Generic::List<PointF^>
does not.