NelIfandieva

Dictionaries_Various_Initializations

Feb 24th, 2018
80
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Numerics;
  5. using System.Text.RegularExpressions;
  6. namespace Learning
  7. {
  8.    
  9.     /*  */
  10.  
  11.     class ListsExer_Problem02
  12.     {
  13.         static void Main()
  14.         {
  15.             //SortedDictionary<string, string> myContacts = new SortedDictionary<string, string>();
  16.             //myContacts["Aglika"] = "+359 887 206 407";
  17.             //myContacts["Yana MM"] = "+359 886 735 722";
  18.             //myContacts["Kotseto TediMuerte"] = "+359 877 333 377";
  19.             //myContacts["Taxi Yellow"] = "+359 2 91119";
  20.             //myContacts["Fazzi"] = "+359 876 655 420";
  21.             //string aglikaNum = myContacts["Aglika"];
  22.             //Console.WriteLine(aglikaNum);
  23.             //foreach (var contact in myContacts)
  24.             //{
  25.             //    var name = contact.Key;
  26.             //    var number = contact.Value;
  27.             //    Console.WriteLine($"{name}: {number}");
  28.             //}
  29.  
  30.             //Dictionary<char, int> numberLetterRepeatsInText = new Dictionary<char, int>();
  31.             //numberLetterRepeatsInText['a'] = 1000;
  32.             //numberLetterRepeatsInText['b'] = 670;
  33.             //numberLetterRepeatsInText['c'] = 623;
  34.             //numberLetterRepeatsInText['d'] = 344;
  35.             //numberLetterRepeatsInText['e'] = 812;
  36.  
  37.             //foreach(KeyValuePair<char, int> letterRepetition in numberLetterRepeatsInText)
  38.             //{
  39.             //    char letter = letterRepetition.Key;
  40.             //    int timesRepeated = letterRepetition.Value;
  41.             //    Console.WriteLine($"The letter \"{letter}\" repeats {timesRepeated} times in the given text.");
  42.             //}
  43.  
  44.             Dictionary<string, List<double>> studentRecords = new Dictionary<string, List<double>>();
  45.             studentRecords["Angel"] = new List<double>();
  46.             studentRecords["Angel"].Add(5.50);
  47.             studentRecords["Angel"].Add(4.75);
  48.             studentRecords["Angel"].Add(5.25);
  49.             //Console.WriteLine("Angel: {0}", studentRecords["Angel"]);
  50.             foreach(var angelsRecord in studentRecords)
  51.             {
  52.                 var name = angelsRecord.Key;
  53.                 Console.WriteLine("{0}'s marks: ", name);
  54.                 foreach(var grade in angelsRecord.Value)
  55.                 {
  56.                     Console.WriteLine("\t\t{0} ", grade);
  57.                 }
  58.             }
  59.         }
  60.     }
  61. }
RAW Paste Data