Advertisement
Guest User

Untitled

a guest
Nov 29th, 2012
770
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1. void Main()
  2. {
  3.     dynamic employee = new ExpandoObject();
  4.     ((INotifyPropertyChanged)employee).PropertyChanged +=
  5.         new PropertyChangedEventHandler(HandlePropertyChanges);
  6.     employee.Name = "John Smith";
  7.     employee.Name = "John Smith2";
  8.     var expando = employee as IDictionary<string, Object>;
  9.     expando["Name"] = "John Smith3";
  10. }
  11.  
  12. private static void HandlePropertyChanges(
  13.     object sender, PropertyChangedEventArgs e)
  14. {
  15.     Console.WriteLine("{0} has changed.", e.PropertyName);
  16. }
  17.  
  18. // Output:
  19. // Name has changed.
  20. // Name has changed.
  21. // Name has changed.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement