public PinBlittable(object item) { if (item != null) { this.handle = new SafePinHandle(item); } else { this.handle = null; } this.item = item; this.address = this.AddrOfPinnedObject(); }
public PinArray(IEnumerable enumerable, PinCallback pinCallback) { if (enumerable != null) { var count = this.CountItems(enumerable); this.nodes = new IPinNode[count]; this.pinnedItems = new IntPtr[count]; this.arrayHandle = new SafePinHandle(this.pinnedItems); int i = 0; foreach (var item in enumerable) { this.nodes[i] = pinCallback(item); this.pinnedItems[i] = this.nodes[i].AddrOfPinnedObject(); i++; } } }