fork(4) download
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. class myClass{
  5.  
  6. public string Name { get; set; }
  7. public myClass(){
  8. }
  9. }
  10.  
  11. class MainClass
  12. {
  13.  
  14. public static void Main()
  15. {
  16. string[] array = new string[] { "one", "two", "three" };
  17. IDictionary<string,myClass> col= new Dictionary<string,myClass>();
  18. foreach (string name in array)
  19. {
  20. col[name] = new myClass { Name = "hahah " + name + "!"};
  21. }
  22.  
  23. foreach(var x in col.Values)
  24. {
  25. Console.WriteLine(x.Name);
  26. }
  27.  
  28. Console.WriteLine("Test");
  29. Console.WriteLine(col["two"].Name);
  30. }
  31. }
Success #stdin #stdout 0.04s 38040KB
stdin
Standard input is empty
stdout
hahah one!
hahah two!
hahah three!
Test
hahah two!