Visual Basic (Declaration) | |
---|---|
Public Shared Function Return( _ ByVal result As Object _ ) As CoroutineOperation |
Visual Basic (Usage) | ![]() |
---|---|
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
C# | ![]() |
---|---|
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"); } |
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.
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