Have you looked at this documentation:
https://developer.rhino3d.com/api/cpp/class_o_n___mesh_ngon.html
For the mesh you want to find all the naked edges. These are mesh faces with one edge not shared with another face. The unshared edge is called a naked edge. For help with finding these and making a boundary out of them, look at the discussion in this old post:
Regards,
Terry.