包装类和显式转换操作可以帮助您解决问题。
public class IntergratedPoint{
// private constructor to prevent misuse
// If want, you can do a normal constructor which create both pointApi1 and 2
private IntergratedPoint(){ }
// this can be set to reference either pointApi1 or 2
public double X{get;set;}
public double Y{get;set;}
private Api1.Point pointApi1;
private Api2.Point pointApi2;
public static explicit operator IntegratedPoint(Api1.Point pointApi1){
IntegratedPoint newPoint = new IntegratedPoint();
newPoint.pointApi1 = pointApi1;
newPoint.pointApi2 = new Api1.Point();
// set X and Y for pointApi2
}
// the explicit operator for Api2.Point
public double Distance(){
return pointApi1.Distance();
}
public double Project(){
return pointApi2.Project();
}
public double[] ToArray(){
// don't know what to do, but it you can do either pointApi1.ToArray() or so
}
}