private static New <SlotRankingEnumerator> BindConstructorArguments(SlotRanking slotRanking) { return(new New <SlotRankingEnumerator>(() => { IntPtr result = CreateSlotEnumeratorAdapter(slotRanking.DangerousGetHandle()); GC.KeepAlive(slotRanking); // Extend the lifetime of this handle because the delegate (and its data) is not stored on the heap. return result; })); }
public SlotRankingEnumerator(SlotRanking slotRanking) : base(BindConstructorArguments(slotRanking), new Delete <SlotRankingEnumerator>(DeleteSlotEnumeratorAdapter)) { }