// Set the file path and name. Modify this for your purposes.
string filename="mySchema.xml";
// Create a FileStream object with the file path and name.
System.IO.FileStream myFileStream = new System.IO.FileStream
(filename,System.IO.FileMode.Create);
// Create a new XmlTextWriter object with the FileStream.
System.Xml.XmlTextWriter MyXmlTextWriter =
new System.Xml.XmlTextWriter(myFileStream, System.Text.Encoding.Unicode);
// Write the schema into the DataSet and close the reader.
thisDataSet.WriteXmlSchema(MyXmlTextWriter );
MyXmlTextWriter.Close();