title: Byte * to MemoryStream Conversion
body: <p>I am new to .NET programming paradigm. I am facing a problem.</p>
  
  <p>I have one CLI library written in .NET which is used by my MFC project.</p>
  
  <p>I have a memory buffer allocated using malloc</p>
  
  <p>BYTE * lData = (BYTE *) malloc(lLen);</p>
  
  <p>I pass this buffer to CLI Library. In CLI i need to convert this to MemoryStream.</p>
  
  <p>As of now first i required to convert lData to Array and then set this Array to MemoryStream.</p>
  
  <p>The question is when i convert lData to Byte Array it will allocate same ammount of memory again. </p>
  
  <p>Will it also allocate same amount of memory when setting this to memoryStream?</p>
  
  <p>If yes then is there a way to avoid this three times memory allocation?</p>