Using the .NET Framework Utility
The .NET Framework SDK includes a command-line utility called the XML Schema Definition Tool that helps you generate class files based on XML schema (.xsd) files. Use this utility in conjunction with the DataSet object's WriteXmlSchema method to translate your untyped DataSet into a strongly typed DataSet.
The following command illustrates how to generate a class file from an XML schema file. Open a Command window and type:
C:\>xsd MyNewClass.xsd /d
The first parameter in the command is the path to the XML schema file. The second parameter indicates that the class you want to create is derived from the DataSet class. By default, the tool generates Visual C# .NET class files, but it can also generate Visual Basic .NET class files by adding the appropriate options. To list the tool's available options, type:
Once you've created your new class file, add it to your project. You can now create an instance of your strongly typed DataSet class, as shown in the following Visual C# .NET code snippet:
MyNewClass ds = new MyNewClass();