View Program.cs
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
namespace ConsoleApp7
public class MainProgressReporter : IProgress<double>
View CopyFileEx.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp6
View good.csproj
<Framework name="net451" />
<Framework name="netcoreapp1.0">
<PackageReference Include="Microsoft.NETCore.App" Version="1.1.0" />
View dummy.fs
// getProducts connects to DB to retrieve the products
// getRevenue connects to DB to retrieve revenue based on the product attributes
// convertRevenue and calculateProfit are pure functions
// saveProfit writes the calculated profit to a DB
getProducts 1 |>
getRevenue |>
convertRevenue |>
calculateProfit |>

Value Object

An Address is a good example of a value object. Both addresses with the same attributes will always be the same.


A User is a good example for an entity. It has an identity and even if two different users have same attributes, it will not be a match.


View NonNullableOfT.cs
using System;
/// <summary>
/// Wraps a reference type value which should not be null.
/// </summary>
/// <typeparam name="T"></typeparam>
public struct NonNullable<T> where T : class
private readonly T _value;
View program.cs
using System;
using System.IO;
using System.Linq;
namespace ConsoleApplication4
// see:
// see:
class Program
View Neo4jSample.cs
// Based on:
// - Getting Started with Neo4j in .NET with Neo4jClient Library:
// Other links:
// - Neo4j:
// - Neo4j .NET Client:
// - Cypher query language:
public class Agency { public string Name { get; set; } }
public class Person { public string Name { get; set; } }
View Utils.fs
let randomString len =
let charsLength = chars.Length
let random = System.Random()
let randomChars = [|for i in 0..len -> chars.[random.Next(charsLength)]|]
new System.String(randomChars)
View ClaimsPrincipalParameterBinding.cs
public class ClaimsPrincipalParameterBinding : HttpParameterBinding
public ClaimsPrincipalParameterBinding(HttpParameterDescriptor descriptor)
: base(descriptor)
public override Task ExecuteBindingAsync(ModelMetadataProvider metadataProvider, HttpActionContext actionContext, CancellationToken cancellationToken)
ClaimsPrincipal claimsPrincipal = actionContext.Request.GetRequestContext().Principal as ClaimsPrincipal;