and example to realization from Microsoft.Cci:

internal string GetUserString(int stringHeapIndex)
{
        ....
        int num = c.ReadCompressedInt();
        return c.ReadUTF16(num/2);
}

private unsafe byte* pb;

internal unsafe string ReadUTF16(int charsToRead)
{
        char* pbptr = (char*)pb;
    char[] chArray = new char[charsToRead];
    for (int i = 0; i < charsToRead; i++)
    {
        chArray[i] = pbptr[0];
                pbptr++;
        }
    pb = (byte*) pbptr;
    return new string(chArray, 0, charsToRead);
}


--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---

Reply via email to