   [C#] Automatically creating a folder when creating a file
  I am trying to serialize some objects to files, and many times the location where they are to be saved will not exist.  I use a FileStream for file access (you have to pass one to the serializer) with the FileMode set to Create.  However, if one folder in the path I am saving to doesn't exist (which is often the case), .NET throws an exception telling me that part of the path isn't found.How can I specify that I want to just create any folders that don't exist?Thanks very much for any help.   
  Pseudocode:Create FileInfo for filename you are trying to create.Get path from FileInfo.If Not Directory.Exists(path) Then Directory.Create(path)   ;  Thank you very much.  It worked like a charm.   