Hi Avinash,
Looks like you are converting the datatable to a list.
So, here
List<t_country> is a list of type
t_country_cmn.
Now, t_country_cmnhas to be created.
Generally, List<object> is a dynamic array. With List, you do not need to manage the size on your own. Lists are considered as generics and constructed types. You need to use < and > in the List declaration. Lists handle any element type (starting from a string to a class).
So, depending upon the datatable columns, you need to create the t_country_cmnclass.
Then add the number of rows as list size.
var lstGridData = new List<t_country>(dt.Rows.Count);
Then, you need to pass on the data in the "dt" into the list, like bellow code:
lstGridData.AddRange(from DataRow row in dt.Rows
select
new t_country_cmn(row[column0], row[column1], row[column2], ....);
Depending upon the number of columns, the t_country class should be created here.
now, you have to return this list object, instead of the
return rows.
Let me know if you want more info. Do please provide what are the columns in dt for better explanation.
Thank you,
RelicV