IdeaBlade DevForce 2010 Help Reference
Return Method
See Also  Example Send Feedback
IdeaBlade.EntityModel Assembly > IdeaBlade.EntityModel Namespace > Coroutine Class : Return Method



result
Result to be returned to completion handler
Used to return a result from within a Coroutine iterator.

Syntax

Visual Basic (Declaration) 
Public Shared Function Return( _
   ByVal result As Object _
) As CoroutineOperation
Visual Basic (Usage)Copy Code
Dim result As Object
Dim value As CoroutineOperation
 
value = Coroutine.Return(result)
C# 
public static CoroutineOperation Return( 
   object result
)
C++/CLI 
public:
static CoroutineOperation^ Return( 
   Object^ result
) 

Parameters

result
Result to be returned to completion handler

Example

C#Copy Code
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");
 }

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.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2013 All Rights Reserved.