Update:
Heinzi is right. AutoCAD Polyline is a reference type, not a structure. Good point. But I simplified the script, because what I'm dealing with in a real application is an AutoCAD object, which is a structure. Therefore, please consider it as a structured, non-reference type.
I am looking for the right approach to accept this situation, and would appreciate if anyone could shed some light or help me better understand.
There is an interface at the data access level with two implementations for working with two different providers: AutoCad API and Sketchup.
interface IEntity { void object GetPoly(); void void InsertPoly(object poly); } class AutocadEntity { void object GetPoly() {
The implementation of Autocad GetPoly will return a Polyline object, as it is defined in the Autocad APIs as a polyline, while Sketchup will return a Face object.
I defined the return type (and parameter) as an object to work with these different types. Cost is a performance issue in which boxing / unpacking occurs. And it more boldly shows where return / parameter is the object [].
At first I wondered if the return / parameter type generic method is a solution, but then I think this is not the case, since implementations are type-specific.
source share