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