I have property of Stream
type
public System.IO.Stream UploadStream { get; set; }
How can I convert it into a string
and send on to other side where I can again convert it into System.IO.Stream
?
I don't know what do you mean by converting a stream to a string. Also what's the other side?
In order to convert a stream to a string you need to use an encoding. Here's an example of how this could be done if we suppose that the stream represents UTF-8 encoded bytes:
using (var reader = new StreamReader(foo.UploadStream, Encoding.UTF8))
{
string value = reader.ReadToEnd();
// Do something with the value
}