I've been looking in the "Text Visualizer" in the Locals window. For some
is being copied into sb3. I had anticipated that StringBuilder would
"Barry Kelly" wrote:
> Bill <Bill@discussions.microsoft.com> wrote:
>
> > public string BugOrFeature()
> > {
> > StringBuilder sb1 = new StringBuilder();
> > StringBuilder sb2 = new StringBuilder();
> > StringBuilder sb3 = new StringBuilder();
> >
> > char[] cTxtSeg = new char[48];
> >
> > sb1.Append("0123456789abcdefghij");
> > sb1.CopyTo(0, cTxtSeg, 0, 10);
> >
> > sb2.Append(cTxtSeg);
> > sb3.AppendFormat("{0} wert wert", sb2.ToString());
> >
> > return sb.ToString();
> > }
> >
> > 0123456789
>
> You have an error in your function: sb is not a known identifier. I have
> the following program:
>
> ---8<---
> using System;
> using System.Text;
>
> class App
> {
> static void Main()
> {
> StringBuilder sb1 = new StringBuilder();
> StringBuilder sb2 = new StringBuilder();
> StringBuilder sb3 = new StringBuilder();
>
> char[] cTxtSeg = new char[48];
>
> sb1.Append("0123456789abcdefghij");
> sb1.CopyTo(0, cTxtSeg, 0, 10);
>
> sb2.Append(cTxtSeg);
> sb3.AppendFormat("{0} wert wert", sb2.ToString());
>
> Console.WriteLine(sb3.ToString());
> }
> }
> --->8---
>
> It prints this on the console:
>
> ---8<---
> 0123456789 wert wert
> --->8---
>
> Can you modify this program to reproduce your problem?
>
> -- Barry
>
> --
>
http://barrkel.blogspot.com/