December 2018
Beginner to intermediate
668 pages
15h 30m
English
Add a new console application project named WorkingWithDictionaries.
Import the same namespaces as before.
In the Main method, type the following code that illustrates some of the common ways of working with dictionaries:
var keywords = new Dictionary<string, string>();
keywords.Add("int", "32-bit integer data type");
keywords.Add("long", "64-bit integer data type");
keywords.Add("float", "Single precision floating point number");
WriteLine("Keywords and their definitions");
foreach (KeyValuePair<string, string> item in keywords)
{
WriteLine($" {item.Key}: {item.Value}");
}
WriteLine($"The definition of long is {keywords["long"]}");
Run the application to view the output:
Keywords and their definitions int: 32-bit ...
Read now
Unlock full access