I have an object model that contains a boolean field MyBool. I want populate that boolean with a linq-to-sql query based on whether or not the database field MyField contains data.
This is what I have:
var TheQuery = (from x in .....
where .....
select new MyModel{
MyBool = x.MyField.Contains(*)
}).ToList();
I’m trying with the .Contain extension method but it’s not working. Any suggestions?
Thanks
I’d suggest that, according to your incomplete example,
should be
And you should have brackets around the Linq expression.
A more complete example might be useful, though.