Click here to Skip to main content
15,901,666 members
Home / Discussions / C#
   

C#

 
GeneralRe: Appending Quations to a string Pin
Arun Philip Reynolds20-Mar-12 10:21
Arun Philip Reynolds20-Mar-12 10:21 
AnswerRe: Appending Quations to a string Pin
Luc Pattyn20-Mar-12 10:27
sitebuilderLuc Pattyn20-Mar-12 10:27 
GeneralRe: Appending Quations to a string Pin
PIEBALDconsult20-Mar-12 11:05
mvePIEBALDconsult20-Mar-12 11:05 
GeneralRe: Appending Quations to a string Pin
Arun Philip Reynolds20-Mar-12 11:08
Arun Philip Reynolds20-Mar-12 11:08 
GeneralRe: Appending Quations to a string Pin
BobJanova21-Mar-12 3:15
BobJanova21-Mar-12 3:15 
AnswerRe: Appending Quations to a string Pin
wizardzz20-Mar-12 9:47
wizardzz20-Mar-12 9:47 
AnswerRe: Appending Quations to a string Pin
Subin Mavunkal20-Mar-12 23:17
Subin Mavunkal20-Mar-12 23:17 
AnswerRe: Appending Quations to a string Pin
Pete O'Hanlon21-Mar-12 3:53
mvePete O'Hanlon21-Mar-12 3:53 
An alternative approach is to use a list of strings instead of a StringBuilder to build your list and then concatenate them as you need. Here's one way to do this:
C#
public class FormattedStrings : List<string>()
{
  public override string ToString()
  {
    StringBuilder sb = new StringBuilder();
    bool started = false;
    foreach (string item in this)
    {
      if (started)
      {
        sb.AppendFormat(",\"{0}\"", item);
      }
      else
      {
        started = true;
        sb.AppendFormat("\"{0}\"", item);
      }
    }

    return sb.ToString();
  }
}
I am assuming that you have assigned the @ symbol when you built your StringBuilder.

*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

"Mind bleach! Send me mind bleach!" - Nagy Vilmos


My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility


GeneralRe: Appending Quations to a string Pin
PIEBALDconsult21-Mar-12 4:53
mvePIEBALDconsult21-Mar-12 4:53 
GeneralRe: Appending Quations to a string Pin
Pete O'Hanlon21-Mar-12 5:59
mvePete O'Hanlon21-Mar-12 5:59 
QuestionImage Encryption Pin
Hinnawi8720-Mar-12 5:14
Hinnawi8720-Mar-12 5:14 
GeneralRe: Image Encryption Pin
harold aptroot20-Mar-12 5:37
harold aptroot20-Mar-12 5:37 
AnswerRe: Image Encryption Pin
OriginalGriff20-Mar-12 5:40
mveOriginalGriff20-Mar-12 5:40 
QuestionMortgage Calculator Error Pin
Xonel20-Mar-12 3:32
Xonel20-Mar-12 3:32 
AnswerRe: Mortgage Calculator Error Pin
PIEBALDconsult20-Mar-12 3:37
mvePIEBALDconsult20-Mar-12 3:37 
GeneralRe: Mortgage Calculator Error Pin
Xonel20-Mar-12 3:44
Xonel20-Mar-12 3:44 
AnswerRe: Mortgage Calculator Error Pin
ZurdoDev20-Mar-12 4:33
professionalZurdoDev20-Mar-12 4:33 
AnswerRe: Mortgage Calculator Error Pin
JF201520-Mar-12 3:48
JF201520-Mar-12 3:48 
GeneralRe: Mortgage Calculator Error Pin
Xonel20-Mar-12 3:55
Xonel20-Mar-12 3:55 
AnswerRe: Mortgage Calculator Error Pin
V.20-Mar-12 3:54
professionalV.20-Mar-12 3:54 
GeneralRe: Mortgage Calculator Error Pin
DaveyM6920-Mar-12 5:08
professionalDaveyM6920-Mar-12 5:08 
GeneralRe: Mortgage Calculator Error Pin
V.20-Mar-12 6:20
professionalV.20-Mar-12 6:20 
GeneralRe: Mortgage Calculator Error Pin
PIEBALDconsult20-Mar-12 6:07
mvePIEBALDconsult20-Mar-12 6:07 
GeneralRe: Mortgage Calculator Error Pin
BobJanova21-Mar-12 3:21
BobJanova21-Mar-12 3:21 
QuestionProgram to find color of the pixels being selected in a picture Pin
Supztermc20-Mar-12 1:54
Supztermc20-Mar-12 1:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.