Skip to content

Instantly share code, notes, and snippets.

@tecnocrata
Created October 25, 2012 21:57
Show Gist options
  • Select an option

  • Save tecnocrata/3955700 to your computer and use it in GitHub Desktop.

Select an option

Save tecnocrata/3955700 to your computer and use it in GitHub Desktop.
Un invocador de eventos Thread'Safe
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
PropertyChangedEventHandler tempEvent = PropertyChanged;
if (tempEvent != null)
{
tempEvent(this, new PropertyChangedEventArgs(propertyName));
}
}
//La idea tras realizar la asignacion de PropertyChanged a tempEvent es evitar problemas
//con multiples hilos tratando de acceder al evento.
//Este codigo es Thread-Safe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment