Kind of new to linq,
whats the simplest way to retrieve a single result using linq?
example, my query
var query =
from c in db.productIn
use SingleOrDefault()
if your query always returns only one element as result or exception will be thrown if the result of your query is more than one element.
(from c in db.productInfo
where c.flavor == "Classic Coke" && c.container == "Can"
select c.co2Target).SingleOrDefault();
use FirstOrDefualt()
if your result more than one element and you need any one of then.
(from c in db.productInfo
where c.flavor == "Classic Coke" && c.container == "Can"
select c.co2Target).FirstOrDefault();