fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5.  
  6. public class MyNode<T>
  7. {
  8. public MyNode(T content)
  9. {
  10. Content = content;
  11. }
  12. public T Content { get; set; }
  13. public MyNode<T> Next { get; set; }
  14. }
  15. public class MyLinkedList<T>
  16. {
  17. private int size;
  18. private MyNode<T> head;
  19. private MyNode<T> tail;
  20.  
  21. public MyNode<T> Tail
  22. {
  23. get { return tail; }
  24. set { tail = value; }
  25. }
  26.  
  27. public int Count
  28. {
  29. get { return size; }
  30. set { size = value; }
  31. }
  32.  
  33. public MyNode<T> Head
  34. {
  35. get { return head; }
  36. set { head = value; }
  37. }
  38.  
  39. public void Add<T>(MyNode<T> node)
  40. {
  41. size++;
  42. if (head == null)
  43. {
  44. head = tail = node;
  45. }
  46. else
  47. {
  48. tail.Next = node;
  49. tail = node;
  50. }
  51. }
  52. }
  53.  
  54. public static void Main()
  55. {
  56. // your code goes here
  57. }
  58. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(39,22): warning CS0693: Type parameter `T' has the same name as the type parameter from outer type `Test.MyLinkedList<T>'
prog.cs(15,28): (Location of the symbol related to previous warning)
prog.cs(44,28): error CS0029: Cannot implicitly convert type `Test.MyNode<T> [prog, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]' to `Test.MyNode<T> [prog, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]'
prog.cs(48,26): error CS0029: Cannot implicitly convert type `Test.MyNode<T> [prog, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]' to `Test.MyNode<T> [prog, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]'
prog.cs(49,21): error CS0029: Cannot implicitly convert type `Test.MyNode<T> [prog, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]' to `Test.MyNode<T> [prog, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]'
Compilation failed: 3 error(s), 1 warnings
stdout
Standard output is empty