Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

C# string builder color

Options
  • 18-04-2006 4:46pm
    #1
    Closed Accounts Posts: 214 ✭✭


    Im creating a interpreter in c# for perl,
    when parsing a line i want to add all the words in a line to a string builder,

    Is there any way to add a word to the builder and the color attribute for that word

    Any help is appreciates

    Thanks


Comments

  • Registered Users Posts: 131 ✭✭theexis


    StringBuilder does what it says on the tin - builds strings; its just the correct way of appending strings together. If you want to store colour information you would need to come up with some way of encoding them in the string.

    What is the purpose of using a StringBuilder here though? I'd suggest an object representation stored in a List<> is better which has a String and Colour property for example.


  • Closed Accounts Posts: 4,943 ✭✭✭Mutant_Fruit


    If you're manipulating a lot of strings, and you care about performance, use a stringbuilder. It's that simple. There is no way you can get the same performane as a stringbuilder even if you write code that deals directly with char/byte arrays and then converts it to a string afterwards.


Advertisement