Help with error CS0030: Cannot convert type

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nomad

    Help with error CS0030: Cannot convert type

    Hi,

    When trying to serialize a class I keep getting the message below.
    optionalExtensi onTypeOptionalE xtension is not mandatory so not sure
    why this is appearing.

    If anyone has seen this type of error before and found a way around
    it, it would be greatly appreciated.

    error CS0030: Cannot convert type
    'Confused.HomeI nsurance.BOB.AI G.CDLService.op tionalExtension TypeOptionalExt ension[]'
    to
    'Confused.HomeI nsurance.BOB.AI G.CDLService.op tionalExtension TypeOptionalExt ension'


    Thanks in advance
  • Marc Gravell

    #2
    Re: Help with error CS0030: Cannot convert type

    It sounds like there is a mismatch between an array and a single
    instance... while it may be optional, if some data is found it expects
    to understand it.

    Which serializer are you using, btw?

    We're not going to be able to offer much help without a bit more info
    on how this is all declared...

    Marc

    Comment

    • nomad

      #3
      Re: Help with error CS0030: Cannot convert type

      On Aug 15, 3:24 pm, Marc Gravell <marc.grav...@g mail.comwrote:
      It sounds like there is a mismatch between an array and a single
      instance... while it may be optional, if some data is found it expects
      to understand it.
      >
      Which serializer are you using, btw?
      >
      We're not going to be able to offer much help without a bit more info
      on how this is all declared...
      >
      Marc
      Hi Marc,

      I am using the frameworks XmlSerializer. Although this is optional I
      have tried to initialise an instance of the array i.e.
      optionalExtensi on = new optionalExtensi onTypeOptionalE xtension[] (new
      optionalExtensi onTypeOptionalE xtension()); to see if that works but
      still no joy. I have only been doing C# for about a month so
      apologise if I'm not more specific.

      Appreciate your help

      Comment

      Working...