You just use an anonymous type.
from m in _dtMaster
join c in _dtChild on new { Id = m["id"], SomeValue = m["category"] } equals new { Id = c["masterId"], SomeValue = c["subcategory"] }
select new { ... }
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
This is sample LINQ method syntax join where single column used in join condition.
DataTable _dtMaster = dt();
_dtMaster.Columns.Add("Discription");
DataTable _dtChild = dttt();
_dtMaster.AsEnumerable().Join(_dtChild.AsEnumerable(), _dtmater => Convert.ToString(_dtmater["id"]),
_dtchild => Convert.ToString(_dtchild["id"]), (_dtmater, _dtchild) => new { _dtmater, _dtchild }).ToList().ForEach(o=>o._dtmater.SetField("Discription",o._dtchild["Discription"].ToString()));
Please tell me how to mention multiple columns in join when i will follow above approach method syntax?
please give me a sample code using above approach kind of LINQ where multiple columns will be used in join.
Thanks
You just use an anonymous type.
from m in _dtMaster
join c in _dtChild on new { Id = m["id"], SomeValue = m["category"] } equals new { Id = c["masterId"], SomeValue = c["subcategory"] }
select new { ... }