Get edge of trimmed surface

Hi, I am looking for a method to duplicate edge of a trimmed surface. Sounds simple but I can’t find it…Something similar to Rhino command DupBorder.

So, a trimmed surface is a BREP. To get the naked edges of a BREP, you can run this code:

ObjRef bRef;
Result res = RhinoGet.GetOneObject("Select surface for dup-border", false, ObjectType.Brep, out bRef);
if (res != Result.Success || null == bRef)
    return res;

Brep b = bRef.Brep();
if (null == b)
    return Result.Failure;

Curve[] edges = b.DuplicateNakedEdgeCurves(true, false); //only outer naked edges
if (null == edges) 
    return Result.Failure;

foreach(Curve crv in edges)
    if (null == crv) continue;