Ejemplo n.º 1
0
        public unsafe CFDataBuffer(byte[] buffer)
        {
            this.buffer = buffer;

            /*
             * Copy the buffer to allow the native side to take ownership.
             */
            fixed(byte *ptr = buffer)
            data = CFData.FromData((IntPtr)ptr, buffer.Length);
        }
Ejemplo n.º 2
0
        public CFDataBuffer(byte[] buffer)
        {
            this.buffer = buffer;

            /*
             * Copy the buffer to allow the native side to take ownership.
             */

            var gch = GCHandle.Alloc(buffer, GCHandleType.Pinned);

            data = CFData.FromData(gch.AddrOfPinnedObject(), buffer.Length);
            gch.Free();
        }