<p>I am using XmlSerializer to write and read an object to xml in C#.  I currently use the attributes <code>XmlElement</code> and <code>XmlIgnore</code> to manipulate the serialization of the object.</p>

<p>If my xml file is missing an xml element that I require, my object still deserializes (xml -> object) just fine.   How do I indicate (preferably via Attributes) that a certain field is "required"?</p>

<p>Here is a sample method of what I am using currently:</p>

<pre><code>[XmlElement(ElementName="numberOfWidgets")]
public int NumberThatIsRequired {
    set ...;
    get ...;
}
</code></pre>

<p>My ideal solution would be to add something like an <code>XmlRequired</code> attribute.   </p>

<p>Also, is there a good reference for what Attributes are available to manipulate the behavior of XmlSerializer?</p>

I've got an answer for the second part:
"Attributes that control XML serialization"
.
Still investigating the first part...
EDIT: I strongly suspect you can't do this through XML deserialization itself. I've just run xsd.exe on a sample schema which includes a required attribute - and it's exactly the same if the attribute is marked as being optional. If there were a way of requiring properties to be set, I'd expect it to be implemented in that case.
I suspect you've basically got to just validate your tree of objects after deserializing it. Sorry about that...