fork(21) download
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. public class Test
  6. {
  7.  
  8.  
  9. public static void Main()
  10. {
  11. var list = new List<int>() { 1, 2, 3, 4 };
  12.  
  13. if (list.Count > 1)
  14. list.RemoveRange(1, list.Count - 1);
  15.  
  16. Console.Write(string.Join(",", list.Select(i => i.ToString()).ToArray()));
  17. }
  18. }
Success #stdin #stdout 0.03s 33872KB
stdin
Standard input is empty
stdout
1