Skip to content

Instantly share code, notes, and snippets.

@angelovstanton
Created August 23, 2015 12:39
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 angelovstanton/0202503dddc99a88e58c to your computer and use it in GitHub Desktop.
Save angelovstanton/0202503dddc99a88e58c to your computer and use it in GitHub Desktop.
WeakReferenceTest hugeObject = new WeakReferenceTest();
hugeObject.SharkFirstName = "Sharky";
WeakReference w = new WeakReference(hugeObject);
hugeObject = null;
GC.Collect();
Console.WriteLine((w.Target as WeakReferenceTest).SharkFirstName);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment