static void Main(string[] args) { var demo = new AsyncAwaitDemo(); demo.DoStuff(); while (true) { Console.WriteLine("Doing Stuff on the Main Thread..................."); } }
static void Main() { var demo = new AsyncAwaitDemo(); demo.DoStuff(); while (true) { Thread.Sleep(100); Console.WriteLine("Doing Stuff on the Main Thread..................."); } }
static void Main(string[] args) { var xs = new List <int>() { 1, 5, 2, 3, 4 }; var ys = Filter <int>(xs, x => x % 2 == 0); List <Artist> artists = new List <Artist>(); artists.Add(new Artist("Test")); artists.Add(new Artist("asdf")); artists.Add(new Artist("Falco")); artists.Add(new Artist("newArtist")); artists.Add(new Artist("Falcon")); artists.Add(new Artist("Falcone")); var artistsFiltered = artists.Where(o => o.Name.Contains("Falco")); foreach (Artist art in artistsFiltered) { Console.WriteLine(art.Name); } PullExample.Run(); PushExample.Run(); PushExampleWithSubject.Run(); var oneNumberPerSecond = Observable.Interval(TimeSpan.FromSeconds(1)); var lowNums = from n in oneNumberPerSecond where n < 5 select n; Console.WriteLine("Numbers < 5:"); lowNums.Subscribe(lowNum => { Console.WriteLine(lowNum); }); var t2 = new Thread(() => { int i = 1000; while (i < 1010) { Console.WriteLine(i++); } }); t2.Start(); TasksExample.Run(); NewTaksExample.Run(); var asyncawait = new AsyncAwaitDemo(); #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed asyncawait.DoStuff(); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed int a = 0; while (a < 10) { Console.WriteLine("Do something AsyncAwait"); a++; } oneNumberPerSecond = Observable.Interval(TimeSpan.FromSeconds(1)); var stringsFromNumbers = from n in oneNumberPerSecond select new string('*', (int)n); Console.WriteLine("Strings from numbers:"); stringsFromNumbers.Subscribe(num => { Console.WriteLine(num); }); }