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
// char array containing lower-case letters from a..z | |
var letters = new char[] {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; | |
// int to binary string with leading zeros | |
Convert.ToString(3, 2).PadLeft(4, '0'); // 0011 | |
Convert.ToString(3, 2).PadLeft(8, '0'); // 00000011 | |
// binary to int | |
int output = Convert.ToInt32(input, 2); |
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 obj = {}; | |
var func = function(){ return 'moro' }; | |
var func2 = function(){ return 'no terve terve'}; | |
console.log(func()); | |
obj.prop = func; |
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; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; | |
using System.Text; | |
namespace WidgetApp | |
{ | |
/// <summary> | |
/// Simple factory that creates a widget based on its name |
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
// Airplane = base class | |
// F16 = derived class | |
// covariance: can use MORE spesific type than originally specified | |
IEnumerable<F16> f16s = new List<F16>(); | |
IEnumerable<Airplane> covariance = f16s; | |
// contravariance: can use LESS specific type than originally specified | |
Action<Airplane> airplanes = (target) => { Console.WriteLine(target.GetType().Name); }; | |
Action<F16> contravariance = airplanes; |
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 Microsoft.VisualBasic.ApplicationServices; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Windows.Forms; | |
namespace WinFormsSingleInstance | |
{ | |
static class Program | |
{ |
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; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Windows.Forms; | |
namespace WinFormsLifecycleEvents |
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; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Windows.Forms; | |
namespace WinFormsDelegateTest |
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; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace SimpleGenericsTest | |
{ | |
/// <summary> | |
/// Generic registration class | |
/// </summary> |
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
-- Table contents | |
-- Customers | |
-- CustomerID CustomerName Country | |
-- 1 Jarmo Suomi | |
-- 2 Risto Ruotsi | |
-- 3 Erno Englanti | |
-- 4 Testeri Testimaa | |
-- Orders |