.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

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

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