LINQ First()
When querying for a single item, bringing back a collection from a query brings back an enumerable list when all you wanted was a single item. You can use the First() method to return the first item in the list, thus getting the item from the query as such:
var data = (from o in Orders
where o.OrderID = id
select o.Name).First();
However, it may cause problems if no records exist in the query, so it may be more beneficial to do:
var data = (from o in Orders
where o.OrderID = id
select o.Name);
if (data.Count() == 0)
return string.Empty;
else
return data.First();