Skip to content

Instantly share code, notes, and snippets.

@vcsjones
Created June 21, 2019 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vcsjones/c5bea29cf7c81958efa9c62958d494b5 to your computer and use it in GitHub Desktop.
Save vcsjones/c5bea29cf7c81958efa9c62958d494b5 to your computer and use it in GitHub Desktop.
[Serializable]
public class LolSerialization : System.Runtime.Serialization.ISerializable
{
public int Test { get; }
public LolSerialization()
{
Test = 1;
}
protected LolSerialization(SerializationInfo info, StreamingContext context)
{
Process.Start("calc.exe");
}
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
}
}
class Program
{
static void Main()
{
var lol = new BinaryFormatter();
using var stream = new MemoryStream();
lol.Serialize(stream, new LolSerialization());
stream.Position = 0;
lol.Deserialize(stream);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment