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

  • SEARCH
  • Home
  • 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 8571167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:43:25+00:00 2026-06-11T18:43:25+00:00

I want to combine a few string properties into a single string to make

  • 0

I want to combine a few string properties into a single string to make sorting and display easier. I was wondering if there was a way to do this without having to iterate through the collection or list of the class. Something like FullName in the below Person class.

public class Person
{
    public string Last {get;set;}
    public string First {get;set;}

    public string FullName = Last + ", " + First {get;}
}
  • 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-11T18:43:26+00:00Added an answer on June 11, 2026 at 6:43 pm

    Update your class like so:

    public class Person
    {
        public string Last { get; set; }
        public string First { get; set; }
    
        public string FullName 
        { 
            get 
            { 
                return string.Format("{0}, {1}", First, Last); 
            } 
        }
    }
    

    Additional to your question, I would also recommend implementing an override of the ToString() method (your question mentions making display easier) as most UI technologies will use this as a default way of displaying an object.

    public override string ToString()
    {
        return FullName;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to combine three sprites and display it as a single sprite. I
I want to combine these two queries into one: mysql_query(INSERT INTO categories (name, parent)
I want to combine 2 parts of the same array to make a complex
I have a controller with 3 hashes I want to combine into 1 object
I want to combine two LINQ query results into one: var query1 = from
I'm wondering if there is a good way to delete multiple columns over a
i found a few scripts online and combined them to this. I want to
I have file with few lines, I want combine all lines with delimiter and
I want to combine AND OR mysql queries in CI. I have already seen
I want to combine the first and last names and present them in the

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.