J
jonpb
Hi,
The following code:
public class SubPoint2D : Point2D
{
public int Code;
}
void ProcessPoints(List<Point2D> pts)
{
return;
}
private void Test()
{
List<SubPoint2D> subPts2D = new List<SubPoint2D>();
ProcessPoints(subPts2D);
}
results in a compiler error: cannot convert List<SubPoint2D> to
List<Point2D>.
Is there a way to tell the compiler that SubPoint2D actually is a
Point2D and therefore the two List<T> types are equivalent as far as
Point2D? I tried:
ProcessPoints(subPts2D as List<Point2D>);
but that didn't work either.
Thanks,
John
The following code:
public class SubPoint2D : Point2D
{
public int Code;
}
void ProcessPoints(List<Point2D> pts)
{
return;
}
private void Test()
{
List<SubPoint2D> subPts2D = new List<SubPoint2D>();
ProcessPoints(subPts2D);
}
results in a compiler error: cannot convert List<SubPoint2D> to
List<Point2D>.
Is there a way to tell the compiler that SubPoint2D actually is a
Point2D and therefore the two List<T> types are equivalent as far as
Point2D? I tried:
ProcessPoints(subPts2D as List<Point2D>);
but that didn't work either.
Thanks,
John