---
title: "MemoryStream in Using Statement - Do I need to call close()"  
description: "MemoryStream in Using Statement - Do I need to call close()"  
author: "Jayden Bell"  
published: 2014-02-03  
updated: 2014-02-03  
canonical: https://www.mindstick.com/forum/1941/memorystream-in-using-statement-do-i-need-to-call-close  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# MemoryStream in Using Statement - Do I need to call close()

When using a [memory](https://www.mindstick.com/blog/300050/what-causes-sudden-memory-loss) [stream](https://yourviews.mindstick.com/view/88509/us-intercepts-iranian-tanker-m-t-stream-amid-hormuz-tensions) in a using statement do I need to call [close](https://yourviews.mindstick.com/story/1687/rubbing-hands-close-up-benefits)? For [instance](https://www.mindstick.com/forum/155658/testing-connection-to-cloud-sql-instance-with-a-mysql-client-from-vm-instance) is ms.Close() needed here?

```
  using (MemoryStream ms = new MemoryStream(byteArray))     {        // stuff       ms.Close();     }
```

## Replies

### Reply by Pravesh Singh

Hi jayden,

No, you don't need. It will be called by the .Dispose() method which is automatically called:

```
using (MemoryStream ms = new MemoryStream(byteArray)){     // stuff}
```


---

Original Source: https://www.mindstick.com/forum/1941/memorystream-in-using-statement-do-i-need-to-call-close

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
