Hello everyone,
I have some phone to each user and I want to store all photos into memory with key-value pair. Key is the user name and value is the binary photo stream. Any ideas how to store binary photo content into memory? Which data structure is suitable to be used?
thanks in advance,
George
Bechir BejaouiRank #144 · 15.9K pointsPosted Nov 28, 2008, 2:04 PM EST
For the first question use MemoryStream object to set bytes in the memory
For the second question use a dictionary object
George GeorgeRank #2,261 · 618 pointsPosted Nov 28, 2008, 11:15 PM EST
Could I just use byte[] other than using MemoryStream? Any pros of using MemoryStream?
byte[] imageData = System.IO.File.ReadAllBytes(filePath);
regards,
George
Bechir BejaouiRank #144 · 15.9K pointsPosted Nov 30, 2008, 5:32 AM EST
byte[]ImageData = Convert.FromBase64String(stringContent);
MemoryStream oStream = new MemoryStream(ImageData);
Image myImage = Image.FromStream(oStream);