Actually, depending on the escaping you wish to perform, you can use two functions that are available in .NET which will make sure your text is valid within XML.
The first, is to use the HttpUtility.HtmlEncode. Since most of the HTML encoding ("<", ">", "&" and the rest) also needs to be encoded in XML, this function will make sure the text you are entering into an XML Text node will be just fine.
If you need to encode a text that will be used as the name of an element (not its content) you can use XmlConvert.EncodeLocalName which will turn every unsupported character to a special representation that can also contain unicode characters.