MemoryStream 不包含 GetBuffer() 的定义
MemoryStream does not contain a definition for GetBuffer()
我已经开始使用 C# 和 .NET Core,我正尝试在
的答案中实现代码
但是,我的线条有问题
writer.Write(innerStream.GetBuffer(), 0, length);
和
var base64 = Convert.ToBase64String(stream.GetBuffer(), 0, (int)stream.Length).ToCharArray();
其中方法 getBuffer()
似乎不再可用。我收到错误:
"'MemoryStream' does not contain a definition for 'GetBuffer' and no extension method 'GetBuffer' accepting a first argument of type 'MemoryStream' could be found (are you missing a using directive or an assembly reference?)"
关于 Google 的唯一其他实例似乎在 https://github.com/hultqvist/ProtoBuf/issues/35 但没有给我指示我应该进行什么样的重构。
而不是 GetBuffer
你需要使用 TryGetBuffer
.
有关详细信息,请参阅 https://github.com/dotnet/corefx/issues/1897。
我已经开始使用 C# 和 .NET Core,我正尝试在
的答案中实现代码但是,我的线条有问题
writer.Write(innerStream.GetBuffer(), 0, length);
和
var base64 = Convert.ToBase64String(stream.GetBuffer(), 0, (int)stream.Length).ToCharArray();
其中方法 getBuffer()
似乎不再可用。我收到错误:
"'MemoryStream' does not contain a definition for 'GetBuffer' and no extension method 'GetBuffer' accepting a first argument of type 'MemoryStream' could be found (are you missing a using directive or an assembly reference?)"
关于 Google 的唯一其他实例似乎在 https://github.com/hultqvist/ProtoBuf/issues/35 但没有给我指示我应该进行什么样的重构。
而不是 GetBuffer
你需要使用 TryGetBuffer
.
有关详细信息,请参阅 https://github.com/dotnet/corefx/issues/1897。