You would need to do something along these lines
using System.IO;
string pathToFile = @"c:\temp\directorythatdoesntexist\file.txt";
if (!Directory.Exists(Path.GetDirectoryName(pathToFile)))
{
Directory.CreateDirectory(Path.GetDirectoryName(pathToFile));
}
File.Create(pathToFile);