fork(3) download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. int[] a = { 1, 2, 3, 4 };
  8. int[] b = a;
  9. for (int i = 2; i < a.Length - 1; i++)
  10. {
  11. a[i] = a[i + 1];
  12. }
  13. Array.Resize(ref a, a.Length - 1);
  14. foreach(var item in a)
  15. {
  16. Console.Write(item.ToString() + ", ");
  17. }
  18. Console.WriteLine();
  19. foreach(var item in b)
  20. {
  21. Console.Write(item.ToString() + ", ");
  22. }
  23. Console.WriteLine();
  24. }
  25. }
Success #stdin #stdout 0.03s 33792KB
stdin
Standard input is empty
stdout
1, 2, 4, 
1, 2, 4, 4,