C#. Async / Await. Simple example
This is a simple example, we don’t wait for DoSmthAsync() in our calling main thread, just going further, when it is done, using its result
This is a simple example, we don’t wait for DoSmthAsync() in our calling main thread, just going further, when it is done, using its result
static void SyncExample() { // do smth before var fs = new FileStream(); // wait for this operation // do smth after } static
https://leetcode.com/problems/buddy-strings/
/* main idea is to search unmatched symbols, and it shoeld be only 2 of them to swap */ public class Solution { public
https://leetcode.com/problems/add-strings/
public string AddStrings(string num1, string num2) { var needZeroes = num1.Length — num2.Length; // adding leading zeroes var absNeedZeroes = Math.Abs(needZeroes); if (needZeroes
isomorphing strings on leetcode
public bool IsIsomorphic(string s, string t) { if (s.Length != t.Length) return false; var firstStringDict = new Dictionary<char,
https://leetcode.com/problems/valid-palindrome/
my decision below
static bool IsPalindrome(string s) { var alphaNum = GetAlphaNumFromString(s).ToLower(); if (alphaNum == «») return true; var reversed = ReverseString(alphaNum); Console.WriteLine(alphaNum);
Promise.all is all or nothing, it returns promise if all incoming promises resolved
const myPromiseAll = (promises) => { return new Promise((resolve, reject) => {
Компания Embarcadero выпустила первое обновление для RAD Studio, Delphi и C++Builder 11 Alexandria. Оно устраняет несколько важных проблем, относящихся к библиотеке VCL, IDE, поддержке Apple
simple example, task will be created periodically and will be handled in thread pool with Thread.QueueUserWorkItem
var timer = new Timer( (o) => {
simple example
int[] nums = Enumerable.Range(1, 10).ToArray(); var res = nums.AsParallel().Where(n => n < 5).ToArray(); Thread.Sleep(2000); Console.WriteLine(String.Join(» «, res));
output
1 2 3 4