The Delay activity in Workflow Foundation can be used in many scenarios, but the most likely use is in a composite operation, where you want the execution to wait for a response and cast a failure if the response isn't received in proper time.

The Delay activity has just one parameter, which is call Duration. It expects a Timespan variable or expression. If you want the same duration in every place it would be wise to create a variable to hold the value and use it at the right spots or a better option would be to create a custom activity:

  1. Add a new file
  2. Add the delay activity
  3. Set the Duration on the delay activity
  4. Rebuild the project
  5. Add the custom activity to your workflow

In Visual Basic Workflow projects this is how you configure it in the expression:

In Visual C# Workflow project there is a difference based on the edition of Visual Studio you are using. If it is .Net Framework 4 then you have to use Visual Basic syntax and if it is .Net Framework 4.5 you can use C# language in the expression:


Random posts:
Help me, help you. You know how ;-) (click, click, click...) Or buy anything at Amazon. You get the same price, and I get a little bit of money. Follow the Photospots site on Facebook