Advertisement
Schnuk

Untitled

Nov 15th, 2021
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. class Program
  2. {
  3.  
  4. static void Main(string[] args)
  5. {
  6. var list = new List<int>() {1, 2, 3};
  7. var list2 = new List<int>();
  8. list.CopyTo(list2);
  9. }
  10.  
  11. }
  12.  
  13. public static class ListExtension
  14. {
  15. public static void CopyTo(this List<int> list, List<int> result)
  16. {
  17. foreach (var element in list)
  18. result.Add(element);
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement