C#. Sync and Async simple examples

        static void SyncExample()
        {
            // do smth before
            var fs = new FileStream(); // wait for this operation
            // do smth after
        }
        
        static void AsyncExample()
        {
            // do smth before
            var fs = new FileStream(... FileOptions.Asynchronous); // do not wait for this operation
            // do smth after
        }
This entry was posted in Без рубрики. Bookmark the permalink.