I have string object. I need to pass this data to another object of type XYZ. But this object of type XYZ is taking only System.IO.Stream. So how to convert the string data into a stream so that object of XYZ type can use this string data?
Share
You’ll have to pick a text encoding to use to translate the string into a byte array, then use a
MemoryStreamto call your function. For example:You can alter
UTF16to be whatever encoding you’d like to use to pass the string.