Stream to object?

aewarnick

Well-known member
Joined
Jan 29, 2003
Messages
1,031
I have been trying to get my manifested resouces from my app directly into an object variable but I cannot find a method to do it.

Bitmap.FromStream() seems to do this. But how can I do this?

Stream s= Assembly.GetCallingAssembly().GetManifestResourceStream(name);
object o= //Get Object from Stream Code Here.
 
Look in to serialization, which is converting an object to data which is persistable. The Bitmap class has a custom serializer/deserializer which can operate on a byte array of bitmap data rather than serialized data describing the class itself, thats how it works.
 
Oh, ok, so Images are an exception to serialization. I tried serialization but because it did not work on an Image I asked this question.

Are Images the only exception?
 
Anything that implements ISerializable can control its serialization very precisely. Its probably worth looking up the interface in the help and see if it gives you a list of classes that implement it.
 
Back
Top