Extract DataTable values using Linq "C#" <p>I have a datatable dtRecords with values like this:</p> <p><strong>RollNo</strong> <strong>Name</strong></p> <p>120 john</p> <p>121 johney</p> <p>122 sam </p> <p>I want to add those values in a list box like the below format.</p> <p>RollNo:[RollNo] , Name: [Name] </p> <p>Note : [RollNo] is ColumnName Identification Format</p> <p><strong>Expected output:</strong></p> <p>RollNo: 120 ,Name: John</p> <p>RollNo: 121 ,Name: Johney</p> <p>I can achieve this using a for loop but is there some other way such as using linq or any other concept.</p> <p>Please include examples with your suggestions.</p> <p>I tried using the linq code below but I didn't get the proper output. </p> <pre><code>string mystring="RollNo:[RollNo] , Name: [Name]"; List&lt;DataColumn&gt; cols = ClsGlobal.dtRecords.Columns.Cast&lt;DataColumn&gt;().ToList(); dtRecords.AsEnumerable().ToList().ForEach(r =&gt; cols.ForEach(c =&gt;listBox1.Items.Add(mystring.Replace("[" + c.ColumnName + "]", r[c.ColumnName].ToString())))); </code></pre>