System.Buffer.memcpyimpl C# (CSharp) Method

memcpyimpl() static private method

static private memcpyimpl ( byte src, byte dest, int len ) : void
src byte
dest byte
len int
return void
        internal unsafe static void memcpyimpl(byte* src, byte* dest, int len) {
            BCLDebug.Assert(len >= 0, "Negative length in memcopy!");

            // Portable naive implementation
            while (len-- > 0)
                *dest++ = *src++;
        }
    }    

Usage Example

        public unsafe void AppendString(string stringToAppend)
        {
            if (!string.IsNullOrEmpty(stringToAppend))
            {
                if ((this.m_totalSize - this.m_length) < stringToAppend.Length)
                {
                    throw new IndexOutOfRangeException();
                }

                fixed(char *str = ((char *)stringToAppend))
                {
                    char *chPtr = str;

                    Buffer.memcpyimpl((byte *)chPtr, (byte *)(this.m_buffer + this.m_length), stringToAppend.Length * 2);
                }

                this.m_length += stringToAppend.Length;
            }
        }
All Usage Examples Of System.Buffer::memcpyimpl