Наследование: DelegatingObject
 public void UsingModelWithProxyCastingProperty()
 {
     var person = new Person();
     // The cast to the interface will work
     person.Inpc.PropertyChanged +=
             ( sender, args ) => Console.WriteLine( "The field {0} has changed.", args.PropertyName );
     person.Inpc.PropertyChanging +=
             ( sender, args ) => Console.WriteLine( "The field {0} is changing.", args.PropertyName );
     // We have full IntelliSense when working with person.
     // but now accessing .Name looses IntelliSense
     person.Name = "Inigo Montoya";
 }
 public void UsingModelObjectAsDynamic()
 {
     dynamic person = new Person();
     // The cast to the interface will work
     INotifyPropertyChanges inpc = person;
     inpc.PropertyChanged +=
             ( sender, args ) => Console.WriteLine( "The field {0} has changed.", args.PropertyName );
     inpc.PropertyChanging +=
             ( sender, args ) => Console.WriteLine( "The field {0} is changing.", args.PropertyName );
     // We have full IntelliSense when working with person.
     // but now accessing .Name looses IntelliSense
     person.Name = "Inigo Montoya";
 }
 public void UsingModelObjectAsStronglyTyped()
 {
     var person = new Person();
     // Casting first to dynamic triggers the DelegatingObjects casting system
     INotifyPropertyChanges inpc = (dynamic) person;
     inpc.PropertyChanged +=
             ( sender, args ) => Console.WriteLine( "The field {0} has changed.", args.PropertyName );
     inpc.PropertyChanging +=
             ( sender, args ) => Console.WriteLine( "The field {0} is changing.", args.PropertyName );
     // We have full IntelliSense when working with person.
     // We have full IntelliSense when working with person.
     person.Name = "Inigo Montoya";
 }
        public void SharedModulesToShareBehavior()
        {
            var module = new NotifyPropertyChangesModule();
            module.PropertyChanged +=
                    ( sender, args ) => Console.WriteLine( "The field {0} has changed.", args.PropertyName );
            module.PropertyChanging +=
                    ( sender, args ) => Console.WriteLine( "The field {0} is changing.", args.PropertyName );
            var inigo = new Person( module ) { Name = "Inigo" };
            var ian = new Person( module ) { Name = "Ian" };

            inigo.Age = 45;
            ian.Age = 30;
        }