How to transpose the Collection A into below format. Can some one help me with simple solutions. @Sukesh Kumaru @sivagelli
View attachment A.jpg
View attachment A.jpg
DataTable outputTable = new DataTable("OutputTable");
List<int> lst = new List<int>();
foreach (DataRow row in InputTable.Rows) {
outputTable.Columns.Add(new DataColumn(""+row["Name"], Type.GetType("System.String")));
lst.Add(Convert.ToInt32(row["Age"]));
}
DataRow newRow = outputTable.NewRow();
for(int i=0; i< lst.Count;i++) {
newRow[outputTable.Columns[i]] = lst[i];
}
outputTable.Rows.Add(newRow);
ResultCollection=outputTable;
Send your code stage window screen shot with input and output .@Sachin_Kharmale Thanks for the response.
I’m getting the error message stating “Object reference not set to an instance of an object”