fork(1) download
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4.  
  5. namespace Program
  6. {
  7. class Array<T> : IEnumerable
  8. {
  9. private Dictionary<uint, T> array = new Dictionary<uint, T>();
  10.  
  11. public T this[uint index]
  12. {
  13. get { return array[index]; }
  14. set { array[index] = value; }
  15. }
  16.  
  17. public IEnumerator GetEnumerator()
  18. {
  19. foreach(KeyValuePair<uint, T> keyValuePair in array)
  20. {
  21. yield return keyValuePair.Value;
  22. }
  23. }
  24. }
  25.  
  26. class Program
  27. {
  28. static void Main()
  29. {
  30. Array<char> array = new Array<char>();
  31. array[10] = 'X';
  32. array[3] = '8';
  33.  
  34. foreach(char elem in array)
  35. {
  36. Console.WriteLine(elem);
  37. }
  38. }
  39. }
  40. }
Success #stdin #stdout 0.04s 33968KB
stdin
Standard input is empty
stdout
X
8