How to make web service methods return string value in lines format?

Posted by Born To Learn on Stack Overflow See other posts from Stack Overflow or by Born To Learn
Published on 2010-05-20T11:46:34Z Indexed on 2010/05/20 11:50 UTC
Read the original article Hit count: 135

Filed under:
|

How to make web service methods return string value in lines format?

My web service method looks like this

[WebMethod]
public string GetSomeLines()
{
  System.Text.StringBuilder builder = new StringBuilder();
  builder.AppendLine("Line1.");
  builder.AppendLine("Line2.");
  builder.AppendLine("Line3.");
  return builder.ToString();
}

But when I get the result from web browser or from delphi/c# consumer it will be like this:

Line1. Line2. Line3.

While I expect to see:

Line1.
Line2.
Line3.

I know may be returning a StringBuilder or String Array is an option here but I want to know if there is a way to make this with string result.

Thanks for your help.

© Stack Overflow or respective owner

Related posts about c#

Related posts about web-services