Skip to content

Instantly share code, notes, and snippets.

@prakashanantha
Created October 16, 2014 22:16
Show Gist options
  • Save prakashanantha/7cfa54b70103abde1f3e to your computer and use it in GitHub Desktop.
Save prakashanantha/7cfa54b70103abde1f3e to your computer and use it in GitHub Desktop.
Generate Class from DataTable
string s = string.Empty;
foreach (DataTable item in set.Tables)
{
s += Environment.NewLine;
s += "public class " + item.TableName + Environment.NewLine + "{" + Environment.NewLine;
foreach (DataColumn item1 in item.Columns)
{
s += "public " +item1.DataType.ToString() + " " + item1.ColumnName + " {get; set;}" + Environment.NewLine;
}
s += Environment.NewLine + "}";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment