View gist:5463491
using System.Collections.Generic;
using ExtraConstraints;
namespace ConsoleApplication2
{
class Program
{
enum A { A, B, C }
static void Main(string[] args)
View gist:5463224
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication2
{
class Program
{
View gist:5357462
int main(int argc, char *argv[]) {
int n=50;
float h=0.1;
float y[n];
float x[n];
x[0]=0;
x[1]=h;
y[0]=1;
y[1]=1-h;
printf("x %d\n", x[0]);
View gist:4643370
using System;
using System.Numerics;
class Program
{
static void Main(string[] args)
{
var big = BigInteger.Parse("31740433145938592912105182351114162756648188952980016544947666054547291721452");
Console.WriteLine("{0:x}", big); // Outputs 462c72d281050c7f81841462df8830fc80b6dcca183b44c6c149591a6f474eec
Console.Read();
View gist:3983429
public static TValue GetOrCreate<TKey, TValue>(this IThreadSafeDictionary<TKey, TValue> source, TKey key, Func<TValue> valueCreator, Action<TValue> valueAdded)
{
TValue value;
// Multithread spinning
while (true)
{
if (source.TryGetValue(key, out value))
{
return value;
View Settings.StyleCop
<StyleCopSettings Version="105">
<Parsers>
<Parser ParserId="StyleCop.CSharp.CsParser">
<ParserSettings>
<BooleanProperty Name="AnalyzeDesignerFiles">False</BooleanProperty>
<CollectionProperty Name="GeneratedFileFilters">
<Value>\.g\.cs$</Value>
<Value>TemporaryGeneratedFile.*\.cs$</Value>
<Value>\.g\.i\.cs$</Value>
</CollectionProperty>
View gist:3193533
// Copyright (c) 2011 Claus Jørgensen <thedeathart@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
View gist:2949529
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace ConsoleApplication8
{
class Program
{
View gist:2871084
Method:
private Task<TextMessage> SendMessageToServiceAsync(TextMessage message)
{
var tcs = new TaskCompletionSource<TextMessage>();
SendMessageToService(message, (msg) => tcs.SetResult(msg));
return tcs.Task;
}
View gist:1981492
class Test<PageType> : DbContext
where PageType : class
{
private Dictionary<Type, PageType> callbacks = new Dictionary<Type, PageType>();
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
foreach (var type in callbacks.Keys)