Last active
August 29, 2015 14:26
-
-
Save Krumelur/3f93afb50b02fba6a7c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading.Tasks; | |
namespace TestOp | |
{ | |
class MainClass | |
{ | |
public static void Main (string[] args) | |
{ | |
var foo = new foo(); | |
foo.Run(); | |
Console.ReadLine(); | |
} | |
} | |
public class foo | |
{ | |
string token; | |
public foo () | |
{ | |
this.token = "Initial Value"; | |
} | |
Task DoIt(string someString) | |
{ | |
return Task.Delay(0).ContinueWith(t => Console.WriteLine("SomeString is '{0}'", someString)); | |
} | |
async Task Execute(Func<Task> op) | |
{ | |
await op(); | |
} | |
public async void Run() | |
{ | |
var op = DoIt(this.token); | |
this.token = "Changed value"; | |
await Execute(() => op); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment