Problem in appending a string to a already filled string builder(at the beginning by using INSERT) a
- by Newbie
I have a string builder like
StringBuilder sb = new StringBuilder("Value1");
sb.AppendLine("Value2");
Now I have a string say
string str = "value 0";
I did
sb.Insert(0,str);
and then
string[] strArr = sb.ToString().Trim().Replace("\r", string.Empty).Split('\n');
The result I am getting as (Array size of 2 where I should get 3)
[0] value 0 Value1
[1] value2
But the desired output being
[0] Value 0
[1] Value1
[2] Value2
Where I am going wrong?
I am using C#3.0
Please help.. It 's urgent
Thanks