Child/Parent relationship by adding an element to list I have to implement a class with has parent and child fields. The problem is that by adding a child it must immediately keep reference to its' parent. I implemented it and it seems to work but I am not quite sure if I did it right. Any advice will be useful!

namespace DocumentToDocument
{
  public class MyEventArgs&lt;T&gt;: EventArgs
  {
    public T D;
  }

  public class MyList&lt;T&gt; : List&lt;T&gt;
  {
    public event EventHandler OnAdd;

    public new void Add(T item)
    {
      if (null != OnAdd)
      {
        var m = new MyEventArgs&lt;Document&gt; {D = item as Document};

        OnAdd(this, m);
      }
      base.Add(item);
    }
   }

   public class Document
   {
     public Document()
     {
       Children = new MyList&lt;Document&gt;();
       Children.OnAdd += new EventHandler(Children_OnAdd);
     }

     public string Name;

     public Document Parent;

     public MyList&lt;Document&gt; Children;

     public void Children_OnAdd(object sender, EventArgs e)
     {
      ((MyEventArgs&lt;Document&gt;) e).D.Parent = this;
     }
   }

   class Program
   {
     private static void Main(string[] args)
     {
       var d = new Document {Name = "I am a parent"};

       var dd = new Document {Name = "I am a child"};

       d.Children.Add(dd);
     }
   }
 }
Here's how I might restructure it (note, I've removed many of the generics since it seems to be tied to Document - if you do need those classes to go for other types, go back to the generics, otherwise, YAGNI):

namespace DocumentToDocument
{
    using System;
    using System.Collections.Generic;

    public sealed class MyEventArgs : EventArgs
    {
        private readonly Document document;

        public MyEventArgs(Document document)
        {
            this.document = document;
        }

        public Document Document
        {
            get
            {
                return this.document;
            }
        }
    }

    public sealed class MyList : List&lt;Document&gt;
    {
        public event EventHandler&lt;MyEventArgs&gt; OnAdd;

        public new void Add(Document item)
        {
            var onAdd = this.OnAdd;

            if (onAdd != null)
            {
                onAdd(this, new MyEventArgs(item));
            }

            base.Add(item);
        }
    }

    public sealed class Document
    {
        private readonly MyList children = new MyList();

        private readonly string name;

        private Document parent;

        public Document(string name, Document parent = null)
        {
            this.name = name;
            this.parent = parent;
            if (this.parent != null)
            {
                this.parent.Children.Add(this);
            }

            this.children.OnAdd += (sender, e) =&gt; e.Document.Parent = this;
        }

        public string Name
        {
            get
            {
                return this.name;
            }
        }

        public Document Parent
        {
            get
            {
                return this.parent;
            }

            set
            {
                this.parent = value;
            }
        }

        public MyList Children
        {
            get
            {
                return this.children;
            }
        }
    }

    internal static class Program
    {
        private static void Main()
        {
            var d = new Document("I am a parent");
            var dd = new Document("I am a child", d);
        }
    }
}