I have a query.
Is it possible to return One string with multiple column value in linq ??
Like this
string ProductName = ((from P in DataModel.DIS_PRODUCT
join M in DataModel.SET_PACK_UNIT on P.PUNIT_ID equals M.ID
where P.PRODUCT_ID == ProdictId
select P.PRODUCT_NAME +" " + P.WEIGHT + " "+ M.UNIT_SYMBLE)
.Take(1)
).ToString();
You’re using
Take(1)which means you’re still getting anIEnumerable<string>or anIQueryable<string>. Just useFirst()(or possiblyFirstOrDefault()) instead ofTake(1)and you can drop theToString()call as well.That will only work if your LINQ provider supports the string concatenation operation. An alternative is to fetch just the columns you want, and then concatenate at the caller: