'System.IO.Stream' does not contain a defi

2020-04-08 12:17发布

When try to build my Unity 3D project on Windows Store Apps, this error occurs

System.IO.Stream' does not contain a definition for 'Close' and no extension method 'Close' accepting a first argument of type 'System.IO.Stream' could be found

How can I use Streams in Windows 8?

1条回答
Rolldiameter
2楼-- · 2020-04-08 12:21

You get that error because there is no support for Stream.Close on Windows Store Apps.

As is stated on the .Net for Windows Store apps overview page

The subset of managed types and members was designed with a clear focus on Windows Store app development. As a result, it omits the following:

[...]

  • Members that cause confusion (such as the Close method on I/O types).

You will have to replace that with a Dispose() or by using a using statement.

查看更多
登录 后发表回答