public static void Register(Func <object, bool> callback, object targetObj) { // Create a unreachable object that remembers the callback function and target object. Gen2GcCallback gcCallback = new Gen2GcCallback(); gcCallback.Setup(callback, targetObj); }
public PinnableObjectPool(Func <T> factory) { this.factory = factory; Gen2GcCallback.Register(Gen2GcCallbackFunc, this); }