First off, you should define an XSD (XML Schema Definition) that defines the exact XML document that will be exchanged between your two applications. I assume these applications are two disparate and/or non-collocated applications. If not, you should not be using XML to exchange information between your applications. And to be honest even if your applications are disparate and/or non-collocated, you should really use JSON instead of XML for information exchange. XML is a bad format for two reasons. One, the verbosity of XML creates unnecessary overhead for information exchange. Two, XML is a hierarchical document specification not an Object specification so mapping XML to objects is not always clean.
But if you are going to use XML, using an XSD to define your message exchange contract is the way to go. Inside the schema you can define what fields are required and optional, the types of each of your fields, and if you verify all of your XML messages against the schema, you will not run into the issue of an expected field missing, null, or the wrong type.
To use this approach the first thing you need to do is create an XSD. This is actually fairly easy, and if you do not want to do it by hand, if you have a sample XML message, you can quickly and easily generate an XSD from the XML message using this website:
http://www.freeformatter.com/xsd-generator.html
The next thing you have to do is generate C# objects that represent your XSD. Visual Studio has a tool that will do this for you. It is called xsd.exe. It can be a little difficult to find. It is located here: C:\Program Files(x86)\Microsoft SDKs\Windows\v7.0A\Bin. If you do not have the v7.0A directory just drill down to the above listed Windows directory and find whatever version you have and look in that version’s Bin directory.
Put the above directory in your path, open up a command prompt, navigate to where your XSD file is located, and type this:
xsd <your xsd> /c /l:cs /n:<whatever namespace you want> /out:<output directory where you want the classes to go>
E.g.,
xsd order.xsd /c /l:cs /n:xmltest /out:xml
Now take the generate class(es) and copy them into your project. Now you can consume and create XML messages using C# classes. And if you want to see if a particular field from an XML document is present you can just use the getters and setters of the class and check for yourself.
I will include sample code for how to do this below:
Sample XSD:
http://pastebin.com/ExjKz8Yt
Sample class generated from XSD.exe:
http://pastebin.com/m2gXtLp2
How to deserialize and serialize XML messages to and from C# objects—using the above generated class as an example:
http://pastebin.com/HXkw2hJi