Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Casting Issues

Casting Issues

Scheduled Pinned Locked Moved C#
questiondata-structures
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Squeaker
    wrote on last edited by
    #1

    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

    realJSOPR L 2 Replies Last reply
    0
    • S Squeaker

      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

      realJSOPR Offline
      realJSOPR Offline
      realJSOP
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • S Squeaker

        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

        L Offline
        L Offline
        LongRange Shooter
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups