I have a foreach loop with DataSet (ds), CsvFileData is a generic type having three fields: InvestmentAgaID ,InvestmentCode ,HasPosition which are strings. CSVDataList is a list of CsvFileData.
Now I want to convert it into LINQ rather than foreach.
foreach (DataRow drow in ds.Tables[0].Rows)
{
CsvFileData ob = new CsvFileData();
ob.InvestmentAgaID = drow[1].ToString().Trim();
ob.InvestmentCode = drow[0].ToString().Trim();
ob.HasPosition = drow[2].ToString().Trim();
CSVDataList.Add(ob);
}