title: Write byte array to storage file in windows phone
body: <p>I'm using Visual studio 2012, c#, silverlight, windows phone 8 app.</p>
  
  <p>We get our data from a webservice, and through the webservice we get a picture that is an base64 string.</p>
  
  <p>I convert it to a byte array, and now I want to save it so the Storage of the windows phone, using a memory stream? I don't know if it is the right approach. I don't want to save it to isolated storage, just the local folder because I want to show the picture after a person tapped on the link.</p>
  
  <p>this is what I have so far.</p>
  
  <pre><code> byte[] ImageArray;
   var image = Attachmentlist.Attachment.ToString();
   imagename = Attachmentlist.FileName.ToString();
   ImageArray = Convert.FromBase64String(image.ToString());
  
   StorageFolder myfolder = Windows.Storage.ApplicationData.Current.LocalFolder;
   await myfolder.CreateFileAsync(imagename.ToString());
   StorageFile myfile = await myfolder.GetFileAsync(imagename.ToString());
  
  
   MemoryStream ms = new MemoryStream();
  </code></pre>
  
  <p>so after I have initialized the memory stream how do I take the byte array and write it to the storage file, and after that retrieve it again? </p>