- Guest-change delegates refresh the guest list display automatically.


The MainWindow will plug methods into these delegates, so they cannot be serialized.
Remember to do null checks for the delegate.

This will bubble any text changes on the guest (name, age, etc.) up to the window.
int index = this.guestListBox.Items.IndexOf(guest);
if (index >= 0)
{
// disconnect the guest
this.guestListBox.Items.RemoveAt(index);
// create new guest item in the same spot
this.guestListBox.Items.Insert(index, guest);
// re-select the guest
this.guestListBox.SelectedItem = this.guestListBox.Items[index];
}This will unattach the method and delegate when a guest is removed so that the guest doesn't have any "kite strings" still hanging onto it.
This simulates the adding of deserialized (saved) guests so that they will appear in the list box.
Change her name. The guest's name should change in the list box in the MainWindow when you tab out of the name text box in the GuestWindow. The same should happen for age.


This will bubble up the checking account's balance change notification.

Ensure that her account money balance changes immediately in the list box in the MainWindow.
Ensure that her wallet money balance changes immediately in the list box in the MainWindow.
if (this.OnTextChange != null)
{
this.OnTextChange(this);
}Previously we have added null checks to ensure that the delegate actually has a method plugged into it before executing it like this:
Instead, we can shorten this using what is called a Null Conditional Operator which looks like this:
this.OnTextChange?.Invoke(this);The animal's name, age, and weight should update in the list box in the MainWindow after tabbing out of the text boxes in the AnimalWindow. The animal's pregnancy status should update in the list box in the MainWindow after making the animal pregnant in the AnimalWindow.
The animal you edited previously should be loaded properly and should appear in the list box.
© 2026 Northcentral Technical College