Trimmed surfaces become untrimmed inside my compiled c# component

I am writing a component in Visual Studio that sorts a list of geometries by coordinates based on a corresponding list of points. I am using a Geometrybase input to cover various types of geometry and it works fine for everything so far except when I input surfaces. If the surfaces in my list are trimmed they become untrimmed in the output. Naturally, I don’t get this error if I cast them to a Brep parameter prior to inputting them in my component, so I am trying to figure out a way to cast them to Breps inside my component rather than having to do it outside. My output Parameter is GeometryBase as well. I have attached a screenshot of the code where I am trying to do the conversion from Surface to Brep. Is there any other way to keep my surfaces trimmed ? Any help would be greatly appreciated.



See attached (added a handy geom Info class as well that allows you to sort your beans - in case that you need to sort them).

GeometryBaseUnbox_V1.3dm (104.7 KB) (9.4 KB)

PS: For such very simple things I can hardly justify using VS (but indeed the C# build in editor is 100% crap).

Looks similar to this: