var x = 1;
// same as string.Format("A {0} B", x)
var y1 = $"A {x} B"; // y == "A 1 B"
// $@ for multiline
var y2 = $@"A
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
1. Syntax of `switch`. | |
2. Syntax of `for`. | |
3. Array initializers thorugh `{}` (so now it is both `new[] {}` and `{}`) | |
4. Having both `delegate(..) {..}` and `(..) => ..`. | |
5. Reserving `*` for rarely-used pointer syntax. |
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
angular.module('...').directive('ancestorClass', function() { | |
'use strict'; | |
function link(scope, element, attrs) { | |
var targets = element.parents().filter(attrs.selector); | |
scope.$watch(attrs.class, function(value) { | |
for (var key in value) { | |
targets.toggleClass(key, value[key]); | |
} | |
}, true); |
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
// current | |
pvc.Task("build", () => { | |
pvc.Source("WebApplication.sln") | |
.Pipe(new PvcMSBuild( | |
buildTarget: "Clean;Build", | |
enableParallelism: true | |
)) | |
.Pipe(new PvcSomethingElse(...)); | |
}); |
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 each package, lists which projects it is installed in | |
function Write-PackageProjectInstalls([string] $PackageFilter = '') { | |
Set-StrictMode -Version 2 | |
$ErrorActionPreference = 'Stop' | |
Get-Project -All | | |
% { | |
$ProjectName = $_.ProjectName | |
Get-Package $PackageFilter -Project $ProjectName | | |
% { New-Object PSObject -Prop (@{ ProjectName=$ProjectName; PackageId=$_.Id; Version = $_.Version; }) } |
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 Node {} | |
public class NodeA : Node {} | |
public class NodeB : Node {} | |
public class NodeBProcessor : Processor<NodeB> { | |
} | |
public class ProcessingDispatcher { | |
public void Dispatch(Node node) { | |
var processor = FindBestProcessorFor(node); |
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 AshMind.Extensions; | |
using Newtonsoft.Json.Serialization; | |
namespace PatchDesignDemo { | |
public class ContractResolverWithPatchSupport : DefaultContractResolver { | |
private readonly IContractResolver _inner; |
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; | |
namespace SomeUnit { | |
public class AssertHelper { | |
public static AssertHelper Assert { get; } = new AssertHelper(); | |
} | |
} | |
namespace SomeUnit.Extensions { | |
public static class AssertExtensions { |
Diff:
C:\Program Files\Perforce\p4merge.exe -nl %bname -nr %yname %base %mine
Merge:
C:\Program Files\Perforce\p4merge.exe -nb %bname -nl %tname -nr %yname -nm %mname %base %theirs %mine %merged
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
Set-StrictMode -Version 2 | |
$ErrorActionPreference = 'Stop' | |
function Write-ColorOutput([Parameter(Mandatory=$true)] $inputObject, [System.ConsoleColor] $foregroundColor) { | |
$rawUI = $Host.UI.RawUI | |
$saved = $rawUI.ForegroundColor | |
try { | |
$rawUI.ForegroundColor = $foregroundColor | |
Write-Output $inputObject | |
} |