If you really want to stick with a StringBuilder you can use an extension method to give you a List and then you can access it with an element number.
internal static class ExtensionMethods
{
public static List<string> ToList(this StringBuilder stringBuilder)
{
return stringBuilder.ToString().Split(new string[] { Environment.NewLine }, StringSplitOptions.None).ToList();
}
}
You can then access it by calling the ToList() method.
int i = 0;
StringBuilder SB = new StringBuilder();
while (i++ != 1000000)
{
SB.AppendLine(i.ToString());
}
string ChosenElement = SB.ToList()[1000];