IList<string> sources = sourceFileLocation.Split(semicolonSeparater,StringSplitOptions.RemoveEmptyEntries).ToList(); XElement satFiles = new XElement("Files",from f in sources select new XElement("File",f)); XDocument satDoc = new XDocument( new XDeclaration("1.0","UTF-8","yes"),satFiles); string satFilePath = Path.Combine(new FileInfo(Assembly.GetEntryAssembly().Location).DirectoryName,@"Files.xml"); satDoc.Save(satFilePath);