ExtensionMethod.NET Home of 833 C#, Visual Basic, F# and Javascript extension methods


Many times you need an XSD file for a report. I have created this extension to write the xsd based on the data table I feed it into the directory I set.


/// <summary>
/// Writes xsd for report into specified directory
/// </summary>
/// <param name="tblIn">DataTable with XML Schema that you want to write</param>
/// <param name="outputName">Name of xsd you want back.</param>
public static void WriteXMLForReport(this DataTable tblIn, string outputName)
    //Set table name in case it is not set
    tblIn.TableName = outputName;
    string fileName = @"C:\OutDir\" + outputName + ".xsd";
    tblIn.WriteXmlSchema(fileName, true);



Author: John D. Sanders

Submitted on: 19 aug 2011

Language: C#

Type: System.Data.DataTable

Views: 3378