Reputation: 195
What am I doing Wrong ?. This is my code snippet below:
PhotoResult e;
using (var filebytes = new MemoryStream())
{
e.ChosenPhoto.CopyTo(filebytes);
Debug.WriteLine(e.ChosenPhoto.Length); // Outputs the correct length
Debug.WriteLine(filebytes.Length); //Outputs 0
}
Upvotes: 1
Views: 1187
Reputation: 174457
Most likely, you need to reset the position of e.ChosenPhoto
before performing the copy:
e.ChosenPhoto.Position = 0;
The documentation states:
Copying begins at the current position in the current stream
Upvotes: 6