Is there way to rewrite:
var tbl = ds.TABLES; var q = from c in tbl select c.TABLE_TYPE; string s = \"\"; foreach (var item in q.Distinct()) { s
The Distinct extension method in LINQ does not have a query syntax equivalent.
Distinct
See https://docs.microsoft.com/en-us/archive/blogs/charlie/linq-farm-using-distinct-and-avoiding-lambdas for additional information as to why.