Pchp.Core.PhpString.SetCharInChunk C# (CSharp) Method

SetCharInChunk() private method

private SetCharInChunk ( object &chunk, int index, char ch ) : void
chunk object
index int
ch char
return void
        void SetCharInChunk(ref object chunk, int index, char ch)
        {
            AssertChunkObject(chunk);

            if (chunk.GetType() == typeof(string))
            {
                var chars = ((string)chunk).ToCharArray();
                chars[index] = ch;
                chunk = chars;
            }
            else if (chunk.GetType() == typeof(byte[])) ((byte[])chunk)[index] = (byte)ch;
            else if (chunk.GetType() == typeof(PhpString)) ((PhpString)chunk)[index] = ch;
            else if (chunk.GetType() == typeof(char[])) ((char[])chunk)[index] = ch;
            else throw new ArgumentException(chunk.GetType().ToString());
        }