Mercurial > pub > ImplabNet
annotate Implab.Playground/Program.cs @ 266:254d1f255d87 v3
Добавлена метка v3.0.10 для набора изменений 74e048cbaac8
author | cin |
---|---|
date | Mon, 16 Apr 2018 19:45:18 +0300 |
parents | 547a2fc0d93e |
children | 6b3e5c48131b |
rev | line source |
---|---|
255
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
1 using Implab.Diagnostics; |
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
2 using Implab.Formats.Json; |
233 | 3 using Implab.Parallels; |
229 | 4 using Implab.Xml; |
5 using System; | |
233 | 6 using System.Collections.Concurrent; |
229 | 7 using System.Collections.Generic; |
8 using System.IO; | |
9 using System.Linq; | |
10 using System.Text; | |
233 | 11 using System.Threading; |
229 | 12 using System.Threading.Tasks; |
13 using System.Xml; | |
14 using System.Xml.Serialization; | |
15 | |
16 namespace Implab.Playground { | |
255
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
17 using System.Diagnostics; |
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
18 using static Trace<Program>; |
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
19 |
229 | 20 public class Program { |
21 | |
255
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
22 static void Main(string[] args) { |
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
23 var listener = new SimpleTraceListener(Console.Out); |
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
24 |
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
25 var source = Trace<Program>.TraceSource; |
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
26 source.Switch.Level = SourceLevels.All; |
233 | 27 |
255
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
28 source.Listeners.Add(listener); |
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
29 |
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
30 var t = Environment.TickCount; |
233 | 31 |
255
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
32 Main().Wait(); |
229 | 33 |
255
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
34 Console.WriteLine($"Done: {Environment.TickCount - t} ms"); |
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
35 Console.ReadKey(); |
233 | 36 } |
229 | 37 |
255
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
38 static async Task Main() { |
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
39 using (LogicalOperation(nameof(Main))) { |
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
40 Log("Start"); |
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
41 await SomeAsync(); |
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
42 Log("End"); |
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
43 } |
233 | 44 } |
229 | 45 |
255
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
46 static async Task SomeAsync() { |
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
47 using (LogicalOperation(nameof(SomeAsync))) { |
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
48 Log("Do prepare"); |
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
49 await Task.Yield(); |
b00441e04738
Adde workaround to the behaviour of the logical operations stack in conjuction
cin
parents:
236
diff
changeset
|
50 Log("Yield"); |
233 | 51 } |
229 | 52 } |
53 } | |
54 } |