Skip to content

Instantly share code, notes, and snippets.

@BrightShadow
Created September 26, 2018 19:09
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 BrightShadow/a466961ece815daf72fa38537a2ece86 to your computer and use it in GitHub Desktop.
Save BrightShadow/a466961ece815daf72fa38537a2ece86 to your computer and use it in GitHub Desktop.
Example command cleaning to prevent memory leaks.
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
internal class TestViewModel : ViewModel
{
private RelayCommand myGreatCommand;
// ... some stuff here
public override void Cleanup()
{
base.Cleanup();
this.myGreatCommand = null;
GC.Collect();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment