Why does MemoryStream.GetBuffer() always throw?

后端 未结 4 1599
滥情空心
滥情空心 2021-01-03 22:21

The following code will always throw UnuthorizedAccessException (MemoryStream\'s internal buffer cannot be accessed.)

byte[] buf1 = { 2, 3, 5, 7, 11 };
var         


        
4条回答
  •  耶瑟儿~
    2021-01-03 22:32

    You appear to be using MemoryStream(array[]) which does not match any of the three versions mentioned in the docs.

提交回复
热议问题