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. Remoting Collections

Remoting Collections

Scheduled Pinned Locked Moved C#
helpdatabasesysadminquestionannouncement
5 Posts 2 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.
  • B Offline
    B Offline
    billb2112
    wrote on last edited by
    #1

    I have a custom collection that I built that contains strings, doubles and datetimes. When I try and retrieve that collection from the server I get the following error: "The type BarCollection in Assembly, Version=1.0.1106.204, Culture=neutral, PublicKeyToken=null is not marked as serializable." I've derived from CollectionBase and implemented my Add and an indexer (strongly typed). The collection contains a structure that contains the aforementioned strings, doubles and datetimes. I've declared it as [Serializable]. [Serializable] public class BarData { public DateTime BarDateTime; public string BarName; public double d1; public double d2; public double d3; } and here's a snippet of my collection public class BarCollection : CollectionBase { public void Add(BarData bar) { List.Add(bar); } public BarData this[int Index] { get { return (BarData)List[Index]; } set { List[Index] = value; } } } ... I assume the problem is with the non string members, but what else do I need to do to get this sucker over the wire? Thanks. Give me one more medicated peaceful moment

    L 1 Reply Last reply
    0
    • B billb2112

      I have a custom collection that I built that contains strings, doubles and datetimes. When I try and retrieve that collection from the server I get the following error: "The type BarCollection in Assembly, Version=1.0.1106.204, Culture=neutral, PublicKeyToken=null is not marked as serializable." I've derived from CollectionBase and implemented my Add and an indexer (strongly typed). The collection contains a structure that contains the aforementioned strings, doubles and datetimes. I've declared it as [Serializable]. [Serializable] public class BarData { public DateTime BarDateTime; public string BarName; public double d1; public double d2; public double d3; } and here's a snippet of my collection public class BarCollection : CollectionBase { public void Add(BarData bar) { List.Add(bar); } public BarData this[int Index] { get { return (BarData)List[Index]; } set { List[Index] = value; } } } ... I assume the problem is with the non string members, but what else do I need to do to get this sucker over the wire? Thanks. Give me one more medicated peaceful moment

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

      CollectionBAse is already Serializable, but maybe you need to declare an extra Serializable attribute to BArCollection WebBoxes - Yet another collapsable control, but it relies on a "graphics server" for dynamic pretty rounded corners, cool arrows and unlimited font support.

      B 1 Reply Last reply
      0
      • L leppie

        CollectionBAse is already Serializable, but maybe you need to declare an extra Serializable attribute to BArCollection WebBoxes - Yet another collapsable control, but it relies on a "graphics server" for dynamic pretty rounded corners, cool arrows and unlimited font support.

        B Offline
        B Offline
        billb2112
        wrote on last edited by
        #3

        Right above my class definition for BarCollection I have the [Serializable] attribute. Do I need to do something else? Give me one more medicated peaceful moment

        L 1 Reply Last reply
        0
        • B billb2112

          Right above my class definition for BarCollection I have the [Serializable] attribute. Do I need to do something else? Give me one more medicated peaceful moment

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

          Two suggestions 1. Have you tried passing it as a Array instead? 2. Add BarCollection into "container" class. Another thing to look for is the is what property caused the exception. That you should see before the stacktrace. WebBoxes - Yet another collapsable control, but it relies on a "graphics server" for dynamic pretty rounded corners, cool arrows and unlimited font support.

          B 1 Reply Last reply
          0
          • L leppie

            Two suggestions 1. Have you tried passing it as a Array instead? 2. Add BarCollection into "container" class. Another thing to look for is the is what property caused the exception. That you should see before the stacktrace. WebBoxes - Yet another collapsable control, but it relies on a "graphics server" for dynamic pretty rounded corners, cool arrows and unlimited font support.

            B Offline
            B Offline
            billb2112
            wrote on last edited by
            #5

            Thanks for the suggestions, however, I figured out the problem. Yes, BarData had to be marked as serializable, but even though BarCollection is derived from CollectionBase which is supposedly already serialized, I still have to add the [Serializable] attribute above that class as well. This is probably something that is glaringly obvious to anyone that knows anything about remoting ... but did I mention that this is the first day that I've tried it? :-D Thanks for the replies! Give me one more medicated peaceful moment

            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