DevForce Help Reference
Return Method
Example 


Result to be returned to completion handler
Used to return a result from within a Coroutine iterator.
Syntax
'Declaration
 
Public Shared Function Return( _
   ByVal result As Object _
) As CoroutineOperation
'Usage
 
Dim result As Object
Dim value As CoroutineOperation
 
value = Coroutine.Return(result)
public static CoroutineOperation Return( 
   object result
)

Parameters

result
Result to be returned to completion handler
Remarks
Any actions within the iterator following the Return are not executed. Note that this method is of limited use where used within a coroutine running 'parallel' because the return will likely 'return' before any async results and will thus effectively cancel all other pending operations.
Example
public void SampleCoroutineWithResult() {
   var op = Coroutine.Start(CoroutineWithResult);
   op.Completed += (s, e) => {
     MessageBox.Show(e.Result.ToString());
   };
 }

 public IEnumerable<INotifyCompleted> CoroutineWithResult() {

   // A few async actions
   yield return _em1.Customers.Take(3).ExecuteAsync();
   
   yield return _em1.Areas.Take(2).ExecuteAsync();

   // Return something to the caller (showing that the result
   // returned to caller is whatever you want it to be).
   yield return Coroutine.Return("Hello World");
 }
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

Coroutine Class
Coroutine Members

Send Feedback