String - ToXmlDocument

A string extension method that converts the string object to an XmlDocument.

Try it

public static string FileName = "test.xml";

public static void Main()
    var xml =

    //C# Extension Method: String - ToXmlDocument
    var xmlDocument = xml.ToXmlDocument();


    //C# Extension Method: String - ToFileInfo
    var file = FileName.ToFileInfo();


View Source
using System.Xml;

public static partial class Extensions
    /// <summary>
    ///     A string extension method that converts the @this to an XmlDocument.
    /// </summary>
    /// <param name="this">The @this to act on.</param>
    /// <returns>@this as an XmlDocument.</returns>
    public static XmlDocument ToXmlDocument(this string @this)
        var doc = new XmlDocument();
        return doc;