Casting Issues
-
I have an object graph that abstracts the operation of a machine. It will calculate paths, so there are several large lists of points. Currently I am using Zedgraph to plot these lists. Originally I was using Zedgraph's PointPairList for these points. Everything worked OK. But it didn't seem proper to be so closely coupled to Zedgraph. As an interim solution I have created PointPairLists that are identical to Zedgraph (but in my own namespace). I am having trouble casting these to Zedgraph PointPairLists. (I was hoping to avoid having to iterate through these rather large lists.) Here is my question: Is there an elegant solution? Any helpful references or search terms would be helpful. (I did find an MSDN reference to writing custom casting operators.) I feel like I am missing something obvious. Thank you- Squeak
-
I have an object graph that abstracts the operation of a machine. It will calculate paths, so there are several large lists of points. Currently I am using Zedgraph to plot these lists. Originally I was using Zedgraph's PointPairList for these points. Everything worked OK. But it didn't seem proper to be so closely coupled to Zedgraph. As an interim solution I have created PointPairLists that are identical to Zedgraph (but in my own namespace). I am having trouble casting these to Zedgraph PointPairLists. (I was hoping to avoid having to iterate through these rather large lists.) Here is my question: Is there an elegant solution? Any helpful references or search terms would be helpful. (I did find an MSDN reference to writing custom casting operators.) I feel like I am missing something obvious. Thank you- Squeak
So let me get this straight - you're using ZedGraph to graph some data, and you don't think that an internal ZedGraph structure should be so closely coupled to ZedGraph? My advice is to stop over-analyzing it. If you don't, you'll never finish the application.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
-----
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001 -
I have an object graph that abstracts the operation of a machine. It will calculate paths, so there are several large lists of points. Currently I am using Zedgraph to plot these lists. Originally I was using Zedgraph's PointPairList for these points. Everything worked OK. But it didn't seem proper to be so closely coupled to Zedgraph. As an interim solution I have created PointPairLists that are identical to Zedgraph (but in my own namespace). I am having trouble casting these to Zedgraph PointPairLists. (I was hoping to avoid having to iterate through these rather large lists.) Here is my question: Is there an elegant solution? Any helpful references or search terms would be helpful. (I did find an MSDN reference to writing custom casting operators.) I feel like I am missing something obvious. Thank you- Squeak
Zedgraph has a definition as follows:
Ourcompany.PointPairLists points = value;
When you "code the exact same thing" you change the namespace so you have an object that is actually:
Mycompany.PointPairLists;
Unless you explicitely inherit Ourcompany.PointPairLists you will never be able to cast to the object type that they are requesting.
The product probably has a domain uniqueness that using their collections is the only choice. You may also find, if the company is sharp, that they have coded the objects so that they are not inheritable which stops you from encapsulating them as well.