Q:

How to resolve error "Input string is not in correct format"

i am  making application in c#.In that application i am using Code as
 private void WriteCurrentData(HttpRequest request, TextWriter writer)
{
      Stream = Convert.ToString(objstream.m_StreamData[1]);
      writer.WriteLine(string.Format(Stream));
      writer.Flush();
}

where   m_StreamData is ArrayList.
but sometimes i am getting error as
System.FormatException: Input string was not in correct format at System.Text.StringBuilder.AppendFormat() at System.String.Format()

Please Help me.Thanks in advance.

A:

The String.Format() inside your WriteLine() tries to interpret the string (again). You already converted it to a string, so:
//writer.WriteLine(string.Format(Stream));
writer.WriteLine(Stream);

