-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
37 lines (31 loc) · 1.39 KB
/
Copy pathProgram.cs
File metadata and controls
37 lines (31 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using EventsToAwaitables;
using EventsToAwaitables.GenericExtensionMethodWithDelegates;
using EventsToAwaitables.GenericExtensionMethodWithReflection;
using EventsToAwaitables.GenericExtensionMethodWithReflectionAndCustomAwaitable;
using EventsToAwaitables.SimpleExtensionMethod;
var sc = new CustomSynchronizationContext();
sc.Post(_ => ApplicationMain(), null);
async void ApplicationMain()
{
Console.WriteLine("> Normal event");
NormalEventDemo.Run();
await Task.Delay(100);
Console.WriteLine("--------------\n");
Console.WriteLine("> Awaitable event with ad hoc extension method");
await AwaitableEventWithSimpleExtensionMethod.Run();
await Task.Delay(100);
Console.WriteLine("--------------\n");
Console.WriteLine("> Awaitable event with subscribe and unsubscribe delegates");
await GenericExtensionMethodWithDelegates.Run();
await Task.Delay(100);
Console.WriteLine("--------------\n");
Console.WriteLine("> Awaitable event with reflection");
await GenericExtensionMethodWithReflection.Run();
await Task.Delay(100);
Console.WriteLine("--------------\n");
Console.WriteLine("> Awaitable event with reflection plus a custom awaitable that always run the continuation synchronously");
await GenericExtensionMethodWithReflectionAndCustomAwaitable.Run();
await Task.Delay(100);
Console.WriteLine("--------------\n");
}
Console.Read();