.net - System.IO.UnmanagedMemoryStream - why Byte* instead of IntPtr -


anybody have idea why bcl team chose use byte* instead of intptr in constructors unmanagedmemorystream? forces using unsafe context in order construct type. seems have used intptr , wouldn't have forced unsafe context.

i'd guess because safer. if have used intptr, constructor called garbage value. byte* there's @ least shot @ compiler verifying memory valid , pinned. albeit casting intptr byte* pretty simple.


Comments

Popular posts from this blog

unicode - Are email addresses allowed to contain non-alphanumeric characters? -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

c++ - Convert big endian to little endian when reading from a binary file -