Created
October 16, 2014 22:16
-
-
Save prakashanantha/7cfa54b70103abde1f3e to your computer and use it in GitHub Desktop.
Generate Class from DataTable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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