Skip to content

Instantly share code, notes, and snippets.

public class MeasuredInput
{
public string Identifier { get; set; }
public int MeasuredValue { get; set; }
public double Confidence { get; set; }
}
public class Measurement
{
public Measurement(string primaryId, string secondaryId, int value, double adjustedMeasurement)
@alexandrnikitin
alexandrnikitin / gist:8969922
Created February 13, 2014 04:53
Dynamic and extension method
public static class Program
{
public static void Main(string[] args)
{
dynamic a = 1;
MethodWithDynamic(a).Extension();
}
public static int MethodWithDynamic(dynamic a)
{
namespace Lib
{
public interface Counter { int Count(string s); }
public abstract class AbstractClass : AbstractParent
{
public abstract int Foo(int x);
public virtual int Foo(string s) { return Foo(Counter.Count(s)); }
}
using Autofac;
using Xunit;
namespace ClassLibrary1
{
public class Stackoverflow24762539
{
[Fact]
public void Repro()
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace PerformanceProblem
{
public class Program
{
public static void Main()
@alexandrnikitin
alexandrnikitin / PerformanceProblemWithNestedClass_With_T()
Last active August 29, 2015 14:10
PerformanceProblemWithNestedClass_With_T()
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace PerformanceProblem
{
public class Program
{
public static void Main()
@alexandrnikitin
alexandrnikitin / Delegate allocations
Last active August 29, 2015 14:11
Delegate allocations
Empty: 34 items
Identity: 25 items
Always true: 9 items
using System;
using System.Net.Http;
using System.Threading.Tasks;
namespace HttpClientMemoryLeak
{
class Program
{
public static async Task TestMethod()
{
using System;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace HttpClientMemoryLeak
{
class Program
import scala.collection.mutable.LinkedHashMap
val catFile = Seq("1\0012\0013\0014", "5\0016\0017\0018")
var categoryMap = LinkedHashMap[ Int, Tuple2[ String, Int ] ]()
catFile.foreach(line => {
val strs = line.split("\001")
categoryMap += (strs(0).toInt ->(strs(2), strs(3).toInt))
})
categoryMap