Question: I need help with question 6 i have my code below but i don't think i have implement it correctly in my customerlist class code

I need help with question 6 i have my code below but i don't think i have implement it correctly in my customerlist class code  I need help with question 6 i have my code below

using System; using System.Collections.Generic; using System.Text;

namespace CustomerMaintenance public class CustomerList { private List customers;

public delegate void changedhandler(customers); public event changedhandler changed;

public CustomerList() { customers = new List() }

public int Count => customers.Count;

public Customer this[int i]

public Customer this[string firstname] { get { foreach (Customer c in customers)

if (c.FirstName == firstname) return c; return null; }

} public void Fill() => customers = CustomerDB.GetCustomers();

public void Save() => CustomerDB.SaveCustomers(customers);

public void Add(Customer customer) { customers.Add(customer); changed(this); }

public void Add(string firstname, string lastname, string email) { Customer c = new Customer(firstname, lastname, email); frmCustomers.Add(c); changed(this); }

public void Remove(Customer customer) { => customers.Remove(customer) changed(this); }

public static CustomerList operator +()

}

Add a CustomerList class 5. Add a class named CustomerList to the project, and declare a private variable that can store a list of Customer objects. 6. Add the following members to the CustomerList class, coding Count as an expression-bodied property and Fill() and Save() as expression-bodied methods: Constructor Description () Creates a new list of Customer objects. Indexer Description [index] Provides access to the Customer at the specified position. Property Description Count An integer that indicates how many Customer objects are in the list. Method Description Add(customer) Adds the specified Customer object to the list. Remove (customer) Removes the specified Customer object from the list. F111() Fills the list with customer data from a file using the GetCustomers() method of the CustomerDB class. Save() Saves the customers to a file using the SaveCustomers() method of the CustomerDB class. 7. Modify the Customer Maintenance form to use this class. To do that, you'll need to use the Fill() and Save() methods of the CustomerList object instead of the methods of the CustomerDB class. In addition, you'll need to use a for loop instead of a foreach loop when you fill the list box. 8. Run the application and test it to be sure it works properly

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!