String - ToFileInfo

A string extension method that converts the string object to a file information.

Try it

public static string FileName = "test.txt";

public static void Main()
	var text =
    @"<!DOCTYPE html>
<h1>This is <b>bold</b> heading</h1>
<p>This is <u>underlined</u> paragraph</p>
<h2>This is <i>italic</i> heading</h2>
</html> ";
	//C# Extension Method: String - ToFileInfo
	var file = FileName.ToFileInfo();
	// C# Extension Method: FileInfo - WriteAllBytes

View Source
using System.IO;

public static partial class Extensions
    /// <summary>
    ///     A string extension method that converts the @this to a file information.
    /// </summary>
    /// <param name="this">The @this to act on.</param>
    /// <returns>@this as a FileInfo.</returns>
    public static FileInfo ToFileInfo(this string @this)
        return new FileInfo(@this);