+2  A: 

You can control the passed name via the constructor.

public class HtmlHead : XElement
{
    public HtmlHead(object content) : base("head")
    {
        this.Add(content);
    }

    public HtmlHead(params object[] content) : base("head", content) { }
}

When an item is added, change notification is performed or you can create a custom method for adding which everyone should use.

Jaroslav Jandek
Of course, you can't check it at compile time - you would need to create custom architecture (which is pretty easy).
Jaroslav Jandek
I already have a solution in place like you have above, but it only handles the creation of the object. I think creating a custom method for adding that everyone should use is the road I was going to take on this one. I was just hoping there was a better way. Catching the event is also a solution I considered, but then it wouldn't be caught at compile-time and that's really what I need here.Hmm... thinking of more solutions...
sfjedi
As I said, you would need a custom architecture. Like having `HtmlElement` overrides to `Add(Anchor a)`, `Add(Title t)`, ... which would limit the available types and it would be a **compile** check as well. I would presonally not do such a thing (at least not for most html tags) - if programmers do not know HTML, it is pretty bad (educate of fire them) and you can validate later as well. It is (IMHO) too much work for little benefit.
Jaroslav Jandek
I understand and respect your point of view, but I have a much bigger goal in mind that I don't want to entirely divulge in this post that I know is not a simple task.
sfjedi