BenchmarkDotNet-Dev=v0.9.1.0+
OS=Microsoft Windows NT 6.2.9200.0
Processor=Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz, ProcessorCount=8
Frequency=10000000 ticks, Resolution=100.0000 ns, Timer=HPET
HostCLR=MS.NET 4.0.30319.42000, Arch=64-bit RELEASE [RyuJIT]
JitModules=clrjit-v4.6.1063.1
Type=NoSpec Mode=Throughput Platform=AnyCpu
Framework=V45 TargetCount=10
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; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using BenchmarkDotNet.Attributes; | |
namespace BenchmarkDotNet.Samples.Framework | |
{ | |
public class Framework_LinqOfType_vs_ForListToArray |
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 Main() { | |
var fr = System.Globalization.CultureInfo.CreateSpecificCulture("fr-FR"); | |
var enAu = System.Globalization.CultureInfo.CreateSpecificCulture("en-AU"); | |
var zhCn = System.Globalization.CultureInfo.CreateSpecificCulture("zh-CN"); | |
var invariant = System.Globalization.CultureInfo.InstalledUICulture; | |
var chairSitTemplate = MessageTemplate.Parse("I sat at {@Chair} on {SitDate,10:dd-MMM-yyyy}"); | |
chairSitTemplate.Format(fr, new Chair(), DateTimeOffset.UtcNow) | |
.Dump("Format using fr-FR culture uses comma decimal separator and french month names"); |
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
type ASetOfApis = unit->unit | |
module ApiSets = | |
type Primatives = ASetOfApis | |
type Reflection = ASetOfApis | |
type Tasks = ASetOfApis | |
type Collections = ASetOfApis | |
type Linq = ASetOfApis | |
type ConcurrentCollections = ASetOfApis |
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
// Converted to F# from https://gist.github.com/davidfowl/8939f305567e1755412d6dc0b8baf1b7 | |
module Analogy = | |
type ASetOfApis = unit -> unit | |
// Each interface represents a target framework and methods represents groups of APIs available on that target framework. | |
// The goal is to show the relationship between .NET Standard API surface and other .NET platforms | |
// .NET Standard |
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
#r "./bin/NoSpecimenNewInst/lib/net40/Ploeh.AutoFixture.dll" | |
printfn "%A" typeof<Ploeh.AutoFixture.Fixture>.AssemblyQualifiedName | |
let createWithNoSpecNewInst<'T> = | |
let fixture = Ploeh.AutoFixture.Fixture() | |
fun () -> fixture.Create(typeof<'T>, Ploeh.AutoFixture.Kernel.SpecimenContext(fixture)) :?> 'T | |
#r "./bin/NoSpecimenSingleton/lib/net40/Ploeh.AutoFixture.dll" | |
printfn "%A" typeof<Ploeh.AutoFixture.Fixture>.AssemblyQualifiedName | |
let noSpecimenSingleton = typeof<Ploeh.AutoFixture.Kernel.NoSpecimen> |
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
// Step 0. Boilerplate to get the paket.exe tool | |
open System | |
open System.IO | |
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__ | |
if not (File.Exists "paket.exe") then | |
let url = "https://github.com/fsprojects/Paket/releases/download/0.31.5/paket.exe" | |
use wc = new Net.WebClient() | |
let tmp = Path.GetTempFileName() |
I hereby claim:
- I am adamchester on github.
- I am adamchester (https://keybase.io/adamchester) on keybase.
- I have a public key whose fingerprint is 6573 51C0 41D2 58D2 9BE8 83F1 835B 3087 94D3 EC6F
To claim this, I am signing this object:
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
[<AutoOpen>] | |
module Workflow = | |
type State = Initial | Draft | PendingApproval | Approved | Cancelled | Completed | |
type Action = Create | Cancel | SendForApproval | Approve | Reject | Complete | |
type Role = Creator | Approver | Completor | |
type Transition = { Action:Action; From:State; To:State; Roles:Role list } | |
module Transitions = | |
let create = { Action=Create; From=Initial; To=Draft; Roles=[ Creator ] } | |
let cancel = { Action=Cancel; From=Draft; To=Cancelled; Roles=[ Creator ] } | |
let sendForAppr = { Action=SendForApproval; From=Draft; To=PendingApproval; Roles=[ Creator ] } |
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
type State = Initial | Draft | PendingApproval | Approved | Cancelled | Completed | |
type Action = Create | Cancel | SendForApproval | Approve | Reject | Complete | |
type Role = Creator | Approver | Completor | |
type Transition = { Action:Action; From:State; To:State; Roles:Role list } | |
module Transitions = | |
let create = { Action=Create; From=Initial; To=Draft; Roles=[ Creator ] } | |
let cancel = { Action=Cancel; From=Draft; To=Cancelled; Roles=[ Creator ] } | |
let sendForAppr = { Action=SendForApproval; From=Draft; To=PendingApproval; Roles=[ Creator ] } | |
let approve = { Action=Approve; From=PendingApproval; To=Approved; Roles=[ Approver ] } | |
let reject = { Action=Reject; From=PendingApproval; To=Draft; Roles=[ Approver ] } |
NewerOlder