public static DelegateType AsDelegate<DelegateType>(this MethodBase mb) where DelegateType : Delegate { return _openDelegates.GetOrAdd((mb, typeof(DelegateType)), pair => mb.CompileTo<DelegateType>()) as DelegateType; }