[CONNECT update17 .net C#] how to cast CurveVector to DgnCurveVector?

Im trying to create a shape (rectangle). I'm following this page MicroStation .NET: Create Shape using C# (la-solutions.co.uk) 

but when i get to the step of casting the CurveVector to a DgnCurveVector I get an Exception "Unable to cast object of type 'Bentley.GeometryNET.CurveVector' to type 'Bentley.GeometryNET.DgnCurveVector'"

i tried just using the the CurveVector to create the element but it creates it as a line string instead of a shape. CurveVector does not have the SetBoundaryType method so it looks like if I want a shape then I need to use DgnCurveVector. The main different from the example in the link above is that the example is doing this by collection datapoints from a DgnPrimitiveTool where I'm just specifying the points via code. 

Not really sure where I went wrong.

DPoint3d[] pnts = new DPoint3d[5];
                pnts[0].X = 0;
                pnts[0].Y = 0;

                pnts[1].X = 2;
                pnts[1].Y = 0;
                pnts[2].X = 2;
                pnts[2].Y = 3;
                pnts[3].X = 0;
                pnts[3].Y = 3;

                pnts[4].X = 0;
                pnts[4].Y = 0;
                GPArray gPArray = new GPArray();
                gPArray.Add(pnts);

                DgnCurveVector curves = (DgnCurveVector)gPArray.ToCurveVector();

any ideas?