Concatenate int and string in LINQ
- by Waheed
HI, I am using the following code
from c in Country
where c.IsActive.Equals(true)
orderby c.CountryName
select new
{
countryIDCode = c.CountryID + "|" + c.TwoDigitCode,
countryName = c.CountryName
}
but following is the error while doing this...
Unable to cast the type 'System.Int32' to type 'System.Object'. LINQ to Entities only supports casting Entity Data Model primitive types.
CountryID is int type and TwoDigitCode is string type.
Can u please let me know how to concatenate....
Thanks....