```C#
var ms = stream as MemoryStream
```