SHARE
TWEET

Untitled

a guest Nov 29th, 2012 214 Never
  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.
RAW Paste Data
Top