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
void IPrintLinkedList.PrintLinkedList() | |
{ | |
PrintNode(_head); | |
} | |
void PrintNode(ISinglyLinkedNode<T> Node) | |
{ | |
if (Node == null) | |
{ | |
Debug.Write(" | " + "NULL"+ " | " + "\n"); |
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
public final class AlphabetEncoder | |
{ | |
private static final char[] ALPHABET = { '0', '1', '2', ...., 'z' }; | |
private static final int ENCODE_LENGTH = ALPHABET.length; | |
public static String encode(int victim) | |
{ | |
final List<Character> list = new ArrayList<>(); | |
do { |
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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Hashtable ht = new Hashtable(); | |
ht.Add("f", 1); | |
ht.Add("S", 2); | |
ht.Add("j", 3); | |
ht.Add("ffg", 4); | |
ht.Add("yh",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
var handleResults = function (error, results) { | |
} | |
doStuff(inputParam, handleResults); |
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
if (int.TryParse(input, out var quantity)) | |
WriteLine(quantity); | |
else | |
WriteLine("Quantity is not a valid integer!"); | |
WriteLine($"{nameof(quantity)}: {quantity}"); // still valid |
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
byte b1 = 0b00001111; | |
byte b2 = 0b10101010; | |
ushort s1 = 0b1111000011110000; | |
Console.WriteLine($"{b1:X}"); | |
Console.WriteLine($"{b2:X}"); | |
Console.WriteLine($"{s1:X}"); |
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
public class User | |
{ | |
private string userName; | |
// accessors | |
public string UserName | |
{ | |
get => userName; | |
private set => userName = value; | |
} |
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
switch (age) | |
{ | |
case 50: | |
ageBlock = "the big five-oh"; | |
break; | |
case var testAge when (new List<int>() | |
{ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89 }).Contains(testAge): | |
ageBlock = "octogenarian"; | |
break; | |
case var testAge when ((testAge >= 90) & (testAge <= 99)): |
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
//Const pattern check | |
public static void IsPattern(object o) | |
{ | |
if (o is null) Console.WriteLine("it's a const pattern"); | |
//... | |
} | |
public static void IsPattern(object o) | |
{ |
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
private void button1_Click(object sender, EventArgs e) | |
{ | |
byte[] digest; | |
string base64digest; | |
MD5 md5 = new MD5CryptoServiceProvider(); | |
digest = md5.ComputeHash(Encoding.UTF8.GetBytes(textBox1.Text)); | |
base64digest = Convert.ToBase64String(digest, 0, digest.Length); | |
textBox3.Text = base64digest; |
OlderNewer