Archetype.Examples.PersonExamples.UsingModelObjectAsStronglyTyped C# (CSharp) Метод

UsingModelObjectAsStronglyTyped() приватный Метод

private UsingModelObjectAsStronglyTyped ( ) : void
Результат void
        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";
        }