List.Remove

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a collection class that inherits from CollectionBase. I am using the
List.Remove method to remove an object in the collection. When I use it, I
get the following error:

Exception Details: System.Runtime.Serialization.SerializationException: The
type MyEntity in Assembly MyBusiness, Version=1.0.2263.29542,
Culture=neutral, PublicKeyToken=null is not marked as serializable.

What gives?
 
Demetri,

Do you have any specialized code in your collection class? This error
shouldn't show up using CollectionBase, as it doesn't use serialization.

Either that, or are you sure that it isn't another area of your code?

Can you post an example?
 
I'm sorry, MyBaseCollection class which inherits from the CollectionBase
class also inherits from ICloneable. There is a clone method that does
serialization and deserialization. Icky!

I guess thats my answer. I must now mark every class as serializable. Icky!

--
-Demetri


Nicholas Paldino said:
Demetri,

Do you have any specialized code in your collection class? This error
shouldn't show up using CollectionBase, as it doesn't use serialization.

Either that, or are you sure that it isn't another area of your code?

Can you post an example?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Demetri said:
I have a collection class that inherits from CollectionBase. I am using the
List.Remove method to remove an object in the collection. When I use it, I
get the following error:

Exception Details: System.Runtime.Serialization.SerializationException:
The
type MyEntity in Assembly MyBusiness, Version=1.0.2263.29542,
Culture=neutral, PublicKeyToken=null is not marked as serializable.

What gives?
 
Back
Top