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. Web Development
  3. ASP.NET
  4. Returning a collection from a web service function

Returning a collection from a web service function

Scheduled Pinned Locked Moved ASP.NET
data-structuresquestion
4 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.
  • T Offline
    T Offline
    Tatham
    wrote on last edited by
    #1

    I have a base class, lets call it A. Two classes, B and C, in herit from it. I am trying to return a series of objects of type B and C from a web service function. I can't use an array because it cant hold types B and C. I can't use a collection because it can't be serialized.... Any ideas?? :wtf::rolleyes:

    L 1 Reply Last reply
    0
    • T Tatham

      I have a base class, lets call it A. Two classes, B and C, in herit from it. I am trying to return a series of objects of type B and C from a web service function. I can't use an array because it cant hold types B and C. I can't use a collection because it can't be serialized.... Any ideas?? :wtf::rolleyes:

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      An array of A :) I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02

      C 1 Reply Last reply
      0
      • L leppie

        An array of A :) I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02

        C Offline
        C Offline
        ChrisWFL
        wrote on last edited by
        #3

        Leppie's right. An array of A (it's the base class after all) then just cast it back to the appropriate B or C. You can also write a serializer if you want to (they actually aren't that hard in most cases).

        L 1 Reply Last reply
        0
        • C ChrisWFL

          Leppie's right. An array of A (it's the base class after all) then just cast it back to the appropriate B or C. You can also write a serializer if you want to (they actually aren't that hard in most cases).

          L Offline
          L Offline
          leppie
          wrote on last edited by
          #4

          Well, they just need a default constructor :) I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02

          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