public static object Deserialize (Stream stream)
{
if (stream == null)
throw new ArgumentNullException ("stream");
object o = new BinaryFormatter ().Deserialize (stream);
if (o == null || IsInvalidType (o))
throw new ArgumentException ("The provided parameter is not of a supported type for serialization and/or deserialization.");
return o;
}