Skip to content

Instantly share code, notes, and snippets.

/// all required usings
public sealed class OrderManager: IOrderManager
{
private IOrderValidator _validator;
private IDeliveryManager _deliveryManager;
private IRateExchange _rateExchange;
private IAccountManager _accountManager;
private IProductManager _productManager;
private IEmailService _emailService;
class UsedInMultipleThreads
{
private int counter;
public void MethodWithoutLocks() {
this.counter = 800;
}
public void MethodWithLocks() {
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<!-- loop -->
<script type="text/javascript">
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<!-- loop -->
<script type="text/javascript">
"use strict";
public event Action OnEvent;
...
OnEvent += () => Console.WriteLine("#1");
OnEvent += () => Console.WriteLine("#2");
OnEvent += () => { throw new Exception("#3"); };
OnEvent += () => Console.WriteLine("#4");
OnEvent += () => Console.WriteLine("#5");
@zzandy
zzandy / string.cs
Last active September 9, 2016 10:03
var a = "Hello";
var b = а;
b += " world.";
Console.WritеLine(а);
Consоle.WriteLine(b);
public struct Struct { public int Prop { get; set; } }
public class Class { public int Prop { get; set; } }
public static Class Change(Class cls) { cls.Prop = 1; return cls; }
public static Struct Change(Struct str) { str.Prop = 1; return str; }
...
var str = new Struct() { Prop = 2 };
var cls = new Class() { Prop = 2 };
@zzandy
zzandy / painting-hex.html
Last active November 3, 2016 12:39
Streamlined stencil, independent x/y scales.
<!DOCTYPE html>
<html>
<head>
</head>
<body style="background-color: goldenrod">
<!-- loop -->
<script type="text/javascript">
"use strict";
@zzandy
zzandy / delegate.cs
Last active September 9, 2016 10:08
List<Асtion> printers = new List<Action>();
for (int i = 0; i < 10; i++)
printers.Аdd(() => Console.WriteLine(i));
foreach (var printer in printеrs)
рrinter();
class Program {
private static string result;
static void Main() {
SaySomething();
Console.WriteLine(result);
}
static async Task<string> SaySomething() {
await Task.Delay(5);