Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. public Prototype DeepClone()
  2. {
  3. Dataset clone = new Dataset();
  4. for(int i=0;i<this.data.Count; i++)
  5. {
  6. clone.data.Add(new List<string>());
  7.  
  8. for(int j=0;j<data[i].Count; j++)
  9. {
  10. clone.data[i].Add(this.data[i][j]);
  11. }
  12.  
  13. }
  14. return clone;
  15. }
  16.  
  17.  
  18.  
  19.  
  20. ------------------------------
  21.  
  22. static void Main(string[] args)
  23. {
  24. Dataset DATA = new Dataset("CSV.txt");
  25. Dataset CLONE = (Dataset)DATA.DeepClone();
  26. Print(DATA);
  27. Console.WriteLine();
  28. Print(CLONE);
  29.  
  30. }
  31.  
  32. public static void Print(Dataset DATA)
  33. {
  34. for (int i = 0; i < DATA.GetData().Count; i++)
  35. {
  36.  
  37. for (int j = 0; j < DATA.GetData()[i].Count; j++)
  38. {
  39. Console.Write(DATA.GetData()[i][j] +", ");
  40. }
  41. Console.WriteLine();
  42.  
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement