For training related to .net,OOPS,design patterns, MVC,WCF and .net fundamentals
contact at or Click Here

Click here for my training feedbacks


Follow Us

Share your Interview questions here

For software development queries contact

Follow by Email

Learn everything about MSBI

20 April 2011

Convert String to Stream and stream to string

using System.IO;
using System.Text;
using System;
namespace CustomIoClasses
class ClsStream
public static string GetString(Stream ObjPriReader)
return new StreamReader(ObjPriReader).ReadToEnd();
public static Stream GetStream(String StrPriData)
byte[] byteArray = Encoding.ASCII.GetBytes(StrPriData);
MemoryStream stream = new MemoryStream(byteArray);
return stream;
static void Main(string[] args)
string str = "I love my India";