Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9005875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:15:40+00:00 2026-06-16T01:15:40+00:00

I have an optional custom prefix and suffix in my application, that I want

  • 0

I have an optional custom prefix and suffix in my application, that I want to add to each of the items in my string List. I have tried all of the following and none are working. Can someone point me in the right direction please?

List<string> myList = new List<string>{ "dog", "cat", "pig", "bird" };

string prefix = "my ";
string suffix = " sucks!";

StringBuilder sb = new StringBuilder();
sb.Append(suffix);
sb.Insert(0, prefix);
MyList = sb.ToString();  //This gives me red squigglies under sb.ToString();

I also tried:

myList = myList.Join(x => prefix + x + suffix).ToList();  //Red squigglies

and:

sortBox1.Join(prefix + sortBox1 + suffix).ToList();  //Red squigglies

Where am I going wrong here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:15:41+00:00Added an answer on June 16, 2026 at 1:15 am

    It’s not really clear why you’re using a StringBuilder at all here, or why you’d be trying to do a join. It sounds like you want:

    var suckingList = myList.Select(x => "my " + x + " sucks")
                            .ToList();
    

    This is the absolutely normal way of performing a projection to each item in a list using LINQ.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

lets say I have a custom tag with an optional boolean attribute. That attribute
I have a custom MVC application/framework where each action is a function inside of
Assume I have several Views in my WPF application that all show a report,
I'd like to write a function that would have some optional code to be
I have a Python3 script that can take optional command line parameters which the
I have a worker method with an optional parameter Work(string input = DefaultInput) {
I'm trying to implement a custom log4net logger/logmanager so that I can add a
I have a custom item class (basically two string values with associated properties), as
I'm using JSF2 on GlassFish 3. I have a form that accepts and optional
I have an ASP.NET MVC 2 application with a custom StructureMap controller factory to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.