Passing GH_Curve, Curve, PolylineCurve between GH components

I’m developing a Grasshopper plugin that involves passing polyline data between components.
Here is a demo use case:

  • Component comA:
    • In: rectangle3diA
    • Out: PolylineCurveoA
  • Component comB:
    • In: PolylineCurve (either from Rhino, or oA) – iB
    • Out: PolylineCurveoB

As the Grasshopper SDK does not have a pManager.AddPolylineCurveParameter, I guess what I should use is AddCurveParameter for iB

Now I have several questions related to this process:

  1. What should be the data type of oA? PolylineCurve or Curve or GH_Curve?

  2. What should be the data type of iB?
    As I need to process iB as a polyline, if I use PolylineCurve, Grasshopper will report error: Invalid Cast: Curve >> PolylineCurve.
    Or should I use GH_Curve or Curve? Then how should I cast it back to PolylineCurve?

  3. When should GH_Curve be chosen over Curve? It seems the SDK has implicit methods to automatically cast Curve to GH_Curve, then is there any reason I should use it?

OK, for 2., I can do:

            List<Polyline> triPoly = new List<Polyline>();
            foreach (var t in triL)
                Polyline tmp = new Polyline();
                if (t.TryGetPolyline(out tmp))

I think GH handles the wrapping of RhinoCommon classes itself. So you can just pass the Curve out on “oA”. Unless you are dealing with trees (GH_Structure<>), I don’t believe you need to use GH_Curve explicitly.
You can always test class type by this pattern

Curve c;
// get c from somewhere
if (c is PolylineCurve plc)
// do stuff here with plc...