I'm trying to find a way out with this legacy Delphi Prism application. I have never worked on Delphi Prism before.
How do I convert a Stream type to Byte Array type? Please detailed code will be really appreciated as I have no knowledge of Delphi Prism.
Basically I want to upload an Image using WCF service and want to pass the Image data as byte array.
Thanks.
Option 1) If you are using a
MemoryStreamyou can use theMemoryStream.ToArrayMethod directly.Option 2) If you Are using .Net 4, copy the content of the source Stream using the
CopyTomethod to aMemoryStreamand the call theMemoryStream.ToArrayfunction.like so
option 3) you are using a old verison of .Net, you can write a custom function to extract the data from the source stream and then fill a
MemoryStream