Archetype.Examples.PersonExamples.UsingModelWithProxyCastingProperty C# (CSharp) Method

UsingModelWithProxyCastingProperty() private method

private UsingModelWithProxyCastingProperty ( ) : void
return void
        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";
        }
    }