Skip to content

Instantly share code, notes, and snippets.


Cameron MacFarland distantcam

View GitHub Profile

Keybase proof

I hereby claim:

  • I am distantcam on github.
  • I am distantcam ( on keybase.
  • I have a public key whose fingerprint is F6C6 9E11 DC61 9DA7 B310 8417 875C C3D7 5421 5F94

To claim this, I am signing this object:

View Attachment.cs
abstract class Attachment<T> : IAttachment
protected T viewModel;
protected abstract void OnAttach();
void IAttachment.AttachTo(object obj)
viewModel = (T)obj;
View AfterWeaving.cs
public class SomeViewModel : INotifyPropertyChanged
private string <URL>k__BackingField;
public event PropertyChangedEventHandler PropertyChanged;
public string URL
View RxCommand.cs
using System;
using System.Reactive;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Windows.Input;
public class RxCommand : ICommand, IObservable<object>, IDisposable
private readonly ISubject<bool> canExecuteSubject;
private readonly ISubject<object> executeSubject;
distantcam / CecilExtensions.cs
Created Aug 21, 2013
Mono.Cecil Extension Methods
View CecilExtensions.cs
public static class CecilExtensions
/// <summary>
/// Finds a type within the references of an assembly.
/// </summary>
/// <param name="module">The module to search the references of.</param>
/// <param name="type">The type to look for.</param>
/// <returns>The found type definition, or null if the type is not found.</returns>
/// <example>To find <see cref="System.Object"/> within a module.
/// <code>module.Find(typeof(System.Object));</code>
View DictionaryExtensions.cs
using System;
using System.Linq;
namespace System.Collections.Generic
public static class DictionaryExtensions
public static TValue GetOrAdd<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, Func<TKey, TValue> valueFactory)
TValue v;
distantcam / SequentialWhenAll.cs
Last active Feb 3, 2016
An example using `Task.WhenAll` that runs all the tasks on the same thread.
View SequentialWhenAll.cs
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
class Program
static void Main()
distantcam / ShellNew-sln2012
Created Dec 13, 2012
ShellNew registry key for .sln files.
View ShellNew-sln2012
Windows Registry Editor Version 5.00
View Puzzle.cs
using System;
using System.Threading.Tasks;
class Program
static void Main()
Util.Method(() => ActionMethod());
Util.Method(ActionMethod); // Error CS0121 The call is ambiguous between the following methods or properties: 'Util.Method(Action)' and 'Util.Method(Func<Task>)'