Program.cs
55 lines
| 1.4 KiB
| text/x-csharp
|
CSharpLexer
/ Implab.Playground / Program.cs
cin
|
r255 | using Implab.Diagnostics; | ||
using Implab.Formats.Json; | ||||
cin
|
r233 | using Implab.Parallels; | ||
cin
|
r229 | using Implab.Xml; | ||
using System; | ||||
cin
|
r233 | using System.Collections.Concurrent; | ||
cin
|
r229 | using System.Collections.Generic; | ||
using System.IO; | ||||
using System.Linq; | ||||
using System.Text; | ||||
cin
|
r233 | using System.Threading; | ||
cin
|
r229 | using System.Threading.Tasks; | ||
using System.Xml; | ||||
using System.Xml.Serialization; | ||||
namespace Implab.Playground { | ||||
cin
|
r255 | using System.Diagnostics; | ||
using System.Runtime.Remoting.Messaging; | ||||
using static Trace<Program>; | ||||
cin
|
r229 | public class Program { | ||
cin
|
r255 | static void Main(string[] args) { | ||
var listener = new SimpleTraceListener(Console.Out); | ||||
var source = Trace<Program>.TraceSource; | ||||
source.Switch.Level = SourceLevels.All; | ||||
cin
|
r233 | |||
cin
|
r255 | source.Listeners.Add(listener); | ||
var t = Environment.TickCount; | ||||
cin
|
r233 | |||
cin
|
r255 | Main().Wait(); | ||
cin
|
r229 | |||
cin
|
r255 | Console.WriteLine($"Done: {Environment.TickCount - t} ms"); | ||
Console.ReadKey(); | ||||
cin
|
r233 | } | ||
cin
|
r229 | |||
cin
|
r255 | static async Task Main() { | ||
using (LogicalOperation(nameof(Main))) { | ||||
Log("Start"); | ||||
await SomeAsync(); | ||||
Log("End"); | ||||
} | ||||
cin
|
r233 | } | ||
cin
|
r229 | |||
cin
|
r255 | static async Task SomeAsync() { | ||
using (LogicalOperation(nameof(SomeAsync))) { | ||||
Log("Do prepare"); | ||||
await Task.Yield(); | ||||
Log("Yield"); | ||||
cin
|
r233 | } | ||
cin
|
r229 | } | ||
} | ||||
} | ||||