System.IO.PinnedBufferMemoryStream.PinnedBufferMemoryStream C# (CSharp) Méthode

PinnedBufferMemoryStream() private méthode

private PinnedBufferMemoryStream ( byte array ) : System
array byte
Résultat System
        internal PinnedBufferMemoryStream(byte[] array)
        {
            BCLDebug.Assert(array != null, "Array can't be null");

            int len = array.Length;
            // Handle 0 length byte arrays specially.
            if (len == 0) {
                array = new byte[1];
                len = 0;
            }

            _array = array;
            _pinningHandle = new GCHandle(array, GCHandleType.Pinned);
            // Now the byte[] is pinned for the lifetime of this instance.
            // But I also need to get a pointer to that block of memory...
            fixed(byte* ptr = _array)
                Initialize(ptr, len, len, FileAccess.Read, true);
        }
PinnedBufferMemoryStream