Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 29th, 2012  |  syntax: C#  |  size: 0.58 KB  |  views: 154  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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.
clone this paste RAW Paste Data