Question: Create a class that is a dictionary, storing words (as string) and their definition (also as string). Use an indexer to allow users of the

Create a class that is a dictionary, storing words (as string) and their definition (also as string). Use an indexer to allow users of the dictionary to add, modify and retrieve definitions of words.

  • You should be able to add a word like this: dictionary[orange] = A small round juicy citrus fruit.;
  • You should be able to change a definition by reusing the same key word: dictionary[orange] = A small round citrus fruit, typically grown in Florida and California.;
  • You should also be able to retrieve a definition using the indexer: string definitionOfOrange = dictionary[orange];

Note: the .NET platform already defines a Dictionary class, which uses generics and in the real world could be used to do what the exercise is trying to do here, plus a lot more. Do not use that class for this exercise.

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!