Creating an Application Using C# Dictionary

Welcome! Today, we will explore creating a simple address book application using a C# Dictionary. This task will help you understand how to manipulate a Dictionary in C#, focusing on adding, retrieving, and deleting entries. By the end of this lesson, you'll have a solid grasp of these fundamental operations.

Introducing Methods to Implement

In this task, we will implement three methods to manage our address book:

  • AddContact(string name, string phoneNumber): Adds a new contact. Returns false if the contact already exists; otherwise, it adds the contact and returns true. In this task, let's assume phone numbers do not change, so it's not allowed to overwrite an existing contact's number.
  • GetContact(string name): Retrieves the phone number for a given name. Returns null if the contact does not exist.
  • DeleteContact(string name): Deletes a contact with the given name. Returns true if the contact exists and is deleted, otherwise.
Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal