I want to serialize an instance of FtpWebRequest class. Is it possible? When i tried, it gave me error that class is not marked serializable which means I cannot serialize the object but in msdn documentation they mention explicit implementation of ISerializable.GetObjectData
http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest_members(v=vs.90).aspx
What does it mean? Can I serialize it or not? confused pls help
No it isn’t. While it inherits
ISerializable, it lacks the necessary serialization constructor. But perhaps a better question would be:and I can’t think of one. A request is an operational class; it is better to serialize data (the state of your system) – not the spinning cogs that make it work. For the same reasons, I wouldn’t attempt to serialize a connection, a file-stream, etc.
Figure out what data you need to know to get your system back into the necessary state; serialize the data.