Skip to content

Instantly share code, notes, and snippets.

View drub0y's full-sized avatar

Drew Marsh drub0y

View GitHub Profile
using System;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
namespace HackedBrain.Utilities
{
public sealed class ObjectPool<T> where T : class, new()
{
@drub0y
drub0y / DispatcherTaskScheduler.cs
Last active December 2, 2022 15:36
A .NET TPL TaskScheduler implementation that spins up STA threads running a Dispatcher message pump which enables the execution of logic that leverage System.Windows.* components. Why? Well, without this, the use of System.Windows.* components will create a new Dispatcher instance on the currently executing thread and since that thread is a) not…
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Collections.Concurrent;
using System.Windows.Threading;
@drub0y
drub0y / LocalDbPrivateInstance.cs
Last active December 16, 2015 15:29
An utility class designed to work with SQL LocalDb instances inside of integration tests.
using System;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.IO;
@drub0y
drub0y / WinRTUtilities.cs
Created August 29, 2012 23:41
GetMethods WinRT
public static IEnumerable<MethodInfo> GetMethods(this Type type, string name)
{
return GetMethods(type.GetTypeInfo(), name);
}
public static IEnumerable<MethodInfo> GetMethods(this TypeInfo typeInfo, string name)
{
TypeInfo currentTypeInfo = typeInfo;
do