[Mono-list] BinaryFormatter, Deserialize(), casting throws exception.

Wiktor Grębla greblus at gmail.com
Tue Aug 29 03:33:23 EDT 2006


Hi.

Why is this code:

         Stream fs = File.OpenRead("./test.obj");
         BinaryFormatter bf = new BinaryFormatter();

         Mydata d = (Mydata)bf.Deserialize(fs);

throwing: Unhandled Exception: System.InvalidCastException: Cannot cast 
from source type to destination type.

?

W.

-- 
Talkers are no good doers.
http://greblus.go.pl


More information about the Mono-list mailing list