Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
2.2 Basic types: Dictionary
//2.2 Basic types: Dictionary using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Second most used type is Dictionary //Dictionary is a list of Key, Value pairs, where key must be unique Dictionary<int, string> dic = new Dictionary<int, string>(); //same as //Dictionary<int, string> dic = new Dictionary<int, string>() //{ // {5, "five"}, // {6, "six"} //}; dic[5] = "five"; //O(1) if space need not to be allocated, O(n) otherwise dic[6] = "six"; Console.WriteLine(dic[5]); //O(1) Console.WriteLine(dic.ContainsKey(6)); //O(1) dic.Keys.Where(f => f > 5) .ToList() .ForEach(f => Console.WriteLine(dic[f]+" ")); //or dic.Where(f => f.Key > 5) .Select(f => f.Value) .ToList() .ForEach(f => Console.WriteLine(f + "")); } } }
run
|
edit
|
history
|
help
0
sadfghjklö
Test
Regex - Leading zeros
pasar de binario a decimal
3. Delegates and events
lit pe
Display the pattern like diamond by using c# for loop
Found many section of times intersect (can edit)
Vin Generator V1
Vajdalinky