Just after a bit of feed back or peoples ideas on which practice is best.
I currently have a method but am unsure of the best way to approach it from a readability point of view or even from best practices point of view. Or perhaps it doesn't really matter at all and they are all fine?
My three options I explored were:
1)
function double GetObjectArea(CustomObject obj, CustomEnum source)
{
return obj.ListOfApplications.Sum(p => p.Source == source ? object.Area : 0);
}
2)
function double GetObjectArea(CustomObject obj, CustomEnum source)
{
var query = from record in obj.ListOfApplications
where record.Source == source
select object.Area
return query.Sum();
}
3)
function double GetObjectArea(CustomObject obj, CustomEnum source)
{
return obj.ListOfApplications.Where(p.Source == source).Sum(object.Area);
}