List.Remove

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?
 
N

Nicholas Paldino [.NET/C# MVP]

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?
 
G

Guest

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top