Converting string value to System.IO.Stream
-
Hi I want to convert one string input in one of my function in c# to System.IO.Stream object but it gives me conversion error in 2nd line of the below function static myFunc(string strInput) { Stream objStream; objStream=(Stream)strInput; } would much appreciate any help Thank you Share knowledge to enhance your learning
-
Hi I want to convert one string input in one of my function in c# to System.IO.Stream object but it gives me conversion error in 2nd line of the below function static myFunc(string strInput) { Stream objStream; objStream=(Stream)strInput; } would much appreciate any help Thank you Share knowledge to enhance your learning
You can't expect to convert a type to something else just like that. If you can do with a Reader, you can try the
StreamReader
class. Or if you absolutely need a Stream, something like this will workstring obj = "Senthil rocks";
Stream s = new MemoryStream(Encoding.ASCII.GetBytes(obj));Regards Senthil _____________________________ My Blog | My Articles | WinMacro