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. unable to cast object of type 'X' to type 'X'

unable to cast object of type 'X' to type 'X'

Scheduled Pinned Locked Moved C#
helpquestion
25 Posts 7 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.
  • M Martin 0

    Hello,

    Vikram A Punathambekar wrote:

    I'm sure you know this; it's probably just that you weren't using the correct terminology.

    YEP!

    Vikram A Punathambekar wrote:

    Don't worry, your English is far better than my German

    But I'm sure your German is much better than my Hindi. So the point goes to you! :-D

    Vikram A Punathambekar wrote:

    Second, when you say Type1 reference1 = new Type2();

    Did I?

    Vikram A Punathambekar wrote:

    Therefore, assuming Type2 inherits from Type1 (directly or indirectly, it doesn't matter), a subsequent cast like Type1 reference2 = reference1; will always work. (You don't even need a cast!)

    I hope I never suggested something else! I just wanted to find a possible explanation for the original problem, and tried to proof it with a project which is not working (means the project throws an exception, therefor the proof was ok). Too bad that the one who had the problem seems not to care any more. -- modified at 5:05 Tuesday 10th July, 2007

    All the best, Martin

    V Offline
    V Offline
    Vikram A Punathambekar
    wrote on last edited by
    #21

    Martin# wrote:

    Vikram A Punathambekar wrote: Second, when you say Type1 reference1 = new Type2(); Did I?

    Hee hee, when I said "When you say..." I did not imply that you said those words. I was presenting a hypothetical scenario, not saying you said something. BTW, there are far too many languages spoken in India to list. While Hindi is something I'm proficient in, I'm neither very fond of it nor is it my native tongue. About the casting, I think there's just a misunderstanding. Forget all we talked about in this thread and keep up the good work. :)

    Cheers, Vıkram.


    After all is said and done, much is said and little is done.

    M 1 Reply Last reply
    0
    • V Vikram A Punathambekar

      Martin# wrote:

      Vikram A Punathambekar wrote: Second, when you say Type1 reference1 = new Type2(); Did I?

      Hee hee, when I said "When you say..." I did not imply that you said those words. I was presenting a hypothetical scenario, not saying you said something. BTW, there are far too many languages spoken in India to list. While Hindi is something I'm proficient in, I'm neither very fond of it nor is it my native tongue. About the casting, I think there's just a misunderstanding. Forget all we talked about in this thread and keep up the good work. :)

      Cheers, Vıkram.


      After all is said and done, much is said and little is done.

      M Offline
      M Offline
      Martin 0
      wrote on last edited by
      #22

      Vikram A Punathambekar wrote:

      Hee hee, when I said "When you say..." I did not imply that you said those words. I was presenting a hypothetical scenario, not saying you said something.

      Vikram A Punathambekar wrote:

      About the casting, I think there's just a misunderstanding. Forget all we talked about in this thread and keep up the good work.

      :)

      Vikram A Punathambekar wrote:

      Forget all we talked about in this thread and keep up the good work.

      This perfectly fitts to you Signature (Which allways make me laugh when reading) :laugh:

      Vikram A Punathambekar wrote:

      BTW, there are far too many languages spoken in India to list

      Actually, I looked it up bevore answering you! I choosed the one with the most percentage :-D Here is the link to the German Wikipedia page, for your training. http://de.wikipedia.org/wiki/Indische_Sprachen[^]

      All the best, Martin

      V 1 Reply Last reply
      0
      • M Martin 0

        Vikram A Punathambekar wrote:

        Hee hee, when I said "When you say..." I did not imply that you said those words. I was presenting a hypothetical scenario, not saying you said something.

        Vikram A Punathambekar wrote:

        About the casting, I think there's just a misunderstanding. Forget all we talked about in this thread and keep up the good work.

        :)

        Vikram A Punathambekar wrote:

        Forget all we talked about in this thread and keep up the good work.

        This perfectly fitts to you Signature (Which allways make me laugh when reading) :laugh:

        Vikram A Punathambekar wrote:

        BTW, there are far too many languages spoken in India to list

        Actually, I looked it up bevore answering you! I choosed the one with the most percentage :-D Here is the link to the German Wikipedia page, for your training. http://de.wikipedia.org/wiki/Indische_Sprachen[^]

        All the best, Martin

        V Offline
        V Offline
        Vikram A Punathambekar
        wrote on last edited by
        #23

        Martin# wrote:

        This perfectly fitts to you Signature (Which allways make me laugh when reading)

        I thought my sig was profound and thought-provoking. :~

        Martin# wrote:

        I choosed the one with the most percentage

        My mother tongue is Marathi. The Marathas were one of the most powerful groups in medieval India, resisting the Muslim invaders and even driving them back.

        Martin# wrote:

        Here is the link to the German Wikipedia page, for your training.

        Seeing words like sprachwissenschaftliche and gleichberechtigten makes my head spin. :-D German seems to have a lot of long words. Is it true that there is no neuter gender in German and everything is male/female?

        Cheers, Vıkram.


        After all is said and done, much is said and little is done.

        M 1 Reply Last reply
        0
        • V Vikram A Punathambekar

          Martin# wrote:

          This perfectly fitts to you Signature (Which allways make me laugh when reading)

          I thought my sig was profound and thought-provoking. :~

          Martin# wrote:

          I choosed the one with the most percentage

          My mother tongue is Marathi. The Marathas were one of the most powerful groups in medieval India, resisting the Muslim invaders and even driving them back.

          Martin# wrote:

          Here is the link to the German Wikipedia page, for your training.

          Seeing words like sprachwissenschaftliche and gleichberechtigten makes my head spin. :-D German seems to have a lot of long words. Is it true that there is no neuter gender in German and everything is male/female?

          Cheers, Vıkram.


          After all is said and done, much is said and little is done.

          M Offline
          M Offline
          Martin 0
          wrote on last edited by
          #24

          Vikram A Punathambekar wrote:

          Is it true that there is no neuter gender in German and everything is male/female?

          No, there is also neuter words: "das Kind" the child

          All the best, Martin

          1 Reply Last reply
          0
          • J joelbasson

            I have the following line of code ResponseProcessingCSP rpCSP = (ResponseProcessingCSP)CSPManager.Instance.GetResponseProcessesingCSP(ChannelID); GetResponseProcessesingCSP returns an object of type IResponseProcessingCSP ResponseProcessingCSP inherits from type IResponseProcessingCSP as well. This throws an error saying "Unable to cast object of type 'ResponseProcessingCSP' to 'ResponseProcessingCSP' What would be causing this?

            A Offline
            A Offline
            AFSEKI
            wrote on last edited by
            #25

            check Type.IsAssignableFrom

            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