You can write yielding functions like this:
public IEnumerator StepBy () {
Console.WriteLine("Hello from coroutine");
yield return true;
Console.WriteLine("This is another line");
yield return true;
Console.WriteLine("And the last line");
yield return new WaitForCount(5);
Console.WriteLine("Now I'm done");
}
rozgo/Unity.Coroutine
Like Unity3D's coroutines, but for other Mono projects, like tools. This is a MonoTouch example, but feel free to modify for your own use.
C#