Try to set the position to 0 of your stream and do not use your object but the object type.
BinaryFormatter b = new BinaryFormatter();
s.Position = 0;
return (YourObjectType)b.Deserialize(s);
More Related Contents:
- XmlSerializer – There was an error reflecting type
- How to unit test if my object is really serializable?
- How do I prevent print screen
- Sorting Win Form CheckListbox [closed]
- Deserialize JSON into C# dynamic object?
- How do I turn a C# object into a JSON string in .NET?
- Serialize Class containing Dictionary member
- How do I get and set Environment variables in C#?
- What is [Serializable] and when should I use it?
- ShouldSerialize*() vs *Specified Conditional Serialization Pattern
- Serializing private member data
- Editing dictionary values in a foreach loop
- How do you find out when you’ve been loaded via XML Serialization?
- Convert bitmaps to one multipage TIFF image in .NET 2.0
- Best method to obfuscate or secure .Net assemblies [closed]
- Compare two Lists for differences
- DataContractSerializer doesn’t call my constructor?
- How can I ignore a property when serializing using the DataContractSerializer?
- Serializing null in JSON.NET
- Error Deserializing Xml to Object – xmlns=” was not expected
- DataTable to JSON [duplicate]
- ef4 cause Circular reference in web service
- What are the differences between the XmlSerializer and BinaryFormatter
- Ignoring a field during .NET JSON serialization; similar to [XmlIgnore]?
- Ignoring null fields in Json.net
- Is DataContract attributes required for WCF
- Error – is not marked as serializable
- Why is Serializable Attribute required for an object to be serialized
- How to serialize an Exception object in C#?
- Can I use extension methods and LINQ in .NET 2.0 or 3.0?