Amadrias,
As Codemonkey suggested:
> private MyClass(){}
Or if this is a base class, use protected.
> Is there a way to avoid that problem knowing that using
> the ISerializable interface, it stills ask me to
> implement an empty constructor?
ISerializable requires a special parameterized constructor, that requires
logic in it to do the deserialization itself!
The following three part article covers binary serialization in detail:
http://msdn.microsoft.com/msdnmag/issues/02/04/net/
http://msdn.microsoft.com/msdnmag/issues/02/07/net/
http://msdn.microsoft.com/msdnmag/issues/02/09/net/
Hope this helps
Jay
"Amadrias" <(E-Mail Removed)> wrote in message
news:032f01c3ce0d$5e56f640$(E-Mail Removed)...
> Hi all,
>
> I am using a class to transport some data over the
> network. I then added the [Serializable] attribute to the
> class.
>
> My problem is that this class is part of a framework and
> that I do not want developers to call empty constructors.
> But the runtime sends me an exception when I try to
> serialize this class asking me to provide it with an
> empty constructor such as:
>
> public MyClass(){}
>
> Is there a way to avoid that problem knowing that using
> the ISerializable interface, it stills ask me to
> implement an empty constructor?
>
> Thanks for the help.
>
> Amadrias