Created
October 25, 2012 21:57
-
-
Save tecnocrata/3955700 to your computer and use it in GitHub Desktop.
Un invocador de eventos Thread'Safe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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