Last active
November 12, 2018 11:01
-
-
Save yar-shukan/cf57a710c0ee4f82623c24925fe8258d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase); | |
hashSet.Add("abc"); | |
hashSet.Add("Abc"); | |
hashSet.Add("abc"); | |
hashSet.Remove("ABC"); | |
hashSet.Add("abc"); | |
Console.WriteLine(hashSet.Count); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Net.Http; | |
using System.Threading.Tasks; | |
using System.Windows; | |
namespace WpfApplication1 | |
{ | |
/// <summary> | |
/// Interaction logic for MainWindow.xaml | |
/// </summary> | |
public partial class MainWindow : Window | |
{ | |
public MainWindow() | |
{ | |
InitializeComponent(); | |
} | |
// explain how this code will behave | |
private void button_Click(object sender, RoutedEventArgs e) | |
{ | |
string result = GetImportantStuffAsync().Result; | |
MessageBox.Show(result); | |
} | |
private async Task<string> GetImportantStuffAsync() | |
{ | |
var httpClient = new HttpClient(); | |
string response = await httpClient.GetStringAsync("https://google.com"); | |
DoStuffWithResponse(response); | |
return response; | |
} | |
private void DoStuffWithResponse(string response) | |
{ | |
// do something important here | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ConsoleApplication26 | |
{ | |
public class ImportantClass | |
{ | |
private static object _lock = new object(); | |
public void SomeMethod() | |
{ | |
int integer = 5; | |
//please explain this. | |
lock (integer) | |
{ | |
DoStuff(); | |
} | |
object obj = integer; | |
//please explain this. | |
lock (obj) | |
{ | |
DoStuff(); | |
} | |
//please explain this. | |
lock (this) | |
{ | |
DoStuff(); | |
} | |
//please explain this. | |
lock (_lock) | |
{ | |
DoStuff(); | |
} | |
} | |
private static void DoStuff() | |
{ | |
//some important work here | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$folderPath = "D:\input" | |
#write powershell that will get all the files that have "txt" extension (e.g. file with name 'a.txt' but not 'abctxt) and file length > 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ConsoleApplication26 | |
{ | |
public class Program | |
{ | |
//given a string input - find the "word" that occures the most | |
//example 1: input "a a a b b c c", output: "a" | |
//example 2: input "what are you doing? do you like tht?", output: "you" | |
public string GetWordWithMaxOccurance(string input) | |
{ | |
//write your code here | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (var i = 0; i < 3; i++) { | |
setTimeout(function(){ console.log("i: " + i); }, i + 1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment