Your method is fine. I do not believe that search by search query or search is necessary for three string values โโ(however this, of course, is not so). When parsing, I fear blank lines or zeros (even if we know that there should be lines only 0-5).
If you expect such filtering in other places, you should probably create a method (or extension) on WorkOrder that will determine the current state more expressively, for example
public static bool IsNotCompleted(this WorkOrder workOrder) { return workOrder.Status == "0" || workOrder.Status == "1" || workOrder.Status == "2"; }
and then
var wo = from o in workOrders where o.IsNotCompleted() select o;
or (I personally prefer this sitax)
var wo = workOrders.Where(o => o.IsNotCompleted());
Using an extension to describe a state like this will increase readability, and in the future it will be much easier to add / remove status codes.
Lukรกลก Novotnรฝ
source share