I am having issues everywhere with type casting. I am following the API examples from the documentation, but it doesn't seem to work for even the most basic casts.
Edge selEdge = SolidworksTools.Interaction.SelectEdge() //my personal function, works fine, allows you select an edge
CoEdge coEdges = (CoEdge)selEdge.GetCoEdges(); //fails. 'Unable to cast object of type 'System.Object' to type 'SolidWorks.Interop.sldworks.CoEdge'.'
I don't get it. This follows the convention given in the documentation, and is the correct return type, as per the documentation as well. What am I doing wrong?
Edit -- I see this only is an issue for arrays. Is this normal? I have a backup method to enumerate through the object collection and cast each individually. Is this expected behaviour?