look for task
look for task
within an order (IOrderInterface), I want to just see if a specific task exists as completed and just return a bool. Can I do this in a one or two line code instead of looping through the tasks?
Re: look for task
Also, I want to check if any of the properties' address1 matches another address - can I do this without looping through the properties?
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: look for task
You can use LINQ expressions to hide the ugliness of some search loops. For example, if you know the checklist item Description, you can use the following to retrieve its status.
Code: Select all
dynamic order = iOrder;
IEnumerable<dynamic> tasks = order.Tasks;
bool taskCompleted = tasks.Any(t => t.Description == "Checklist Item Description" && t.Status == TaskStatusType.Completed);
Bob Richards, Senior Software Developer, SoftPro
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: look for task
Also, I want to check if any of the properties' address1 matches another address - can I do this without looping through the properties?
There is no single line answer to this.
There is no single line answer to this.
Bob Richards, Senior Software Developer, SoftPro