title: Using generic in the interface
body: <p><strong>Update:</strong></p>
  
  <p>Heinzi is right. AutoCAD Polyline is reference type and not a struct. Good point. But I have simplified the scenario as what I am dealing with in the real application is an AutoCAD object which is struct. So please consider both as struct not reference type.</p>
  
  <hr>
  
  <p>I am looking for the right approach to take in this situation and would appreciate if anyone can shed light or help me to better understanding.</p>
  
  <p>There is an interface in the data access layer with two implementations to deal with two different providers: AutoCad and Sketchup APIs. </p>
  
  <pre><code>interface IEntity
  {
      void object GetPoly();
      void void   InsertPoly(object poly);
  }
  
  class AutocadEntity
  {
      void object GetPoly()
      {
           //calling Autocad APIs
           return Autocad Polyline object
      }
      void InsertPoly(object poly){...}
  }
  </code></pre>
  
  <p>Autocad implementation of GetPoly would return Polyline object as this is what defined in Autocad APIs as polyline, whereas Sketchup would return Face object.</p>
  
  <p>I have defined the return type(and the parameter) as object to deal with these different types. The cost is performance issue where boxing/unboxing happens. And it shows itself more boldly where the return/parameter is object[]. </p>
  
  <p>I first wondered making the method return/parameter type generic is the solution but then I think it wouldn't be as the implementations are type specific.</p>