C# String Concat() Method

Beginner
⏱️ 9 min read
📚 Updated: Jul 2026
🎯 5 Examples
String Methods

What You’ll Learn

The static String.Concat() method joins two or more strings into a single new string. Because C# strings are immutable, the originals stay unchanged—you always assign or use the returned result. It is one of the core tools for building messages, labels, and formatted output.

01

Static Method

string.Concat(...)

02

New String

Immutable result.

03

Many Overloads

2, 3, 4, params, IEnumerable.

04

Null Safe

null → empty string.

05

vs + Operator

When to use each.

06

StringBuilder

For loop building.

Definition and Usage

In C#, string.Concat() combines string arguments in order and returns one new string. It is declared as a static method on the String class, so you call it as string.Concat(a, b) rather than on an instance.

Overloads accept two, three, or four strings directly; a params string[] for any number of arguments; and IEnumerable<T> for collections where each element is converted with ToString(). This flexibility makes Concat() handy when the number of pieces is not fixed at compile time.

💡
Beginner Tip

For two or three pieces, first + " " + last or interpolation $"{first} {last}" is often clearer than Concat(). Reach for Concat() when joining an array or list of strings, or when you want explicit static-method style.

📝 Syntax

Common overloads on System.String:

C#
public static string Concat(string str0, string str1);
public static string Concat(string str0, string str1, string str2);
public static string Concat(params string[] values);
public static string Concat<T>(IEnumerable<T> values);

Parameters

  • String arguments — text pieces to join in order. null is treated as String.Empty.
  • params string[] values — variable number of strings: Concat("a", "b", "c").
  • IEnumerable<T> values — each item converted via ToString() before joining.

Return Value

A new string containing all parts concatenated. Original strings are not modified.

⚡ Quick Reference

GoalCode
Join two stringsstring.Concat("Hello", " C#")
Join with separatorstring.Concat(first, " ", last)
Join many stringsstring.Concat(parts) (array)
Join list itemsstring.Concat(tags) (IEnumerable)
Alternativea + " " + b or $"{a} {b}"
Two strings
string.Concat(a, b)

Basic join

Params
string.Concat("a","b","c")

Variable count

Array
string.Concat(wordArray)

string[] overload

Loop build
StringBuilder + Append

Many iterations

Examples Gallery

Run with dotnet run. Each example shows a practical way to join strings—from simple names to arrays, alternatives, and performance-conscious patterns.

📚 Getting Started

Join two strings with a space separator.

Example 1 — Basic Concat() Usage

Build a full name from first and last name strings with a space between them.

C#
using System;

class Program {
    static void Main() {
        string firstName = "John";
        string lastName  = "Doe";

        string fullName = string.Concat(firstName, " ", lastName);

        Console.WriteLine($"Full Name: {fullName}");
    }
}

How It Works

string.Concat receives three arguments and returns one new string. firstName and lastName are unchanged because strings are immutable.

Example 2 — Concatenate Multiple Strings

Use the params overload to join several pieces in one call.

C#
using System;

class Program {
    static void Main() {
        string greeting = string.Concat(
            "Hello", ", ", "C#", " ", "World", "!");

        Console.WriteLine(greeting);
    }
}

How It Works

The compiler passes all arguments as a string array to the params overload. Order is preserved—each argument appears exactly where you listed it.

📈 Practical Patterns

Arrays, alternatives, and performance.

Example 3 — Join a String Array

Pass a string[] when words come from an array or split operation.

C#
using System;

class Program {
    static void Main() {
        string[] words = { "Learn", "C#", "Strings" };

        string sentence = string.Concat(words);
        string spaced = string.Join(" ", words);

        Console.WriteLine($"Concat: {sentence}");
        Console.WriteLine($"Join:   {spaced}");
    }
}

How It Works

Concat joins with no separator between array elements. When you need a delimiter (like a space), use string.Join(" ", words) instead—it is the right tool for separated lists.

Example 4 — Concat() vs + vs Interpolation

Three common ways to build the same message—pick the most readable for your situation.

C#
using System;

class Program {
    static void Main() {
        string lang = "C#";
        int version = 12;

        string viaConcat  = string.Concat("Language: ", lang, ", Version: ", version.ToString());
        string viaPlus    = "Language: " + lang + ", Version: " + version;
        string viaInterp  = $"Language: {lang}, Version: {version}";

        Console.WriteLine(viaConcat);
        Console.WriteLine(viaPlus);
        Console.WriteLine(viaInterp);
    }
}

How It Works

All three produce the same final text. Interpolation is usually the clearest for mixed text and variables. + is fine for simple joins. Concat() shines with arrays or when you prefer explicit static-method calls.

Example 5 — StringBuilder for Loop Concatenation

When building text inside a loop, avoid repeated Concat() or +—use StringBuilder instead.

C#
using System;
using System.Text;

class Program {
    static void Main() {
        StringBuilder builder = new StringBuilder();

        for (int i = 1; i <= 5; i++) {
            builder.Append("Item ");
            builder.Append(i);
            builder.Append(", ");
        }

        string result = builder.ToString().TrimEnd(',', ' ');
        Console.WriteLine(result);
    }
}

How It Works

Each + or Concat in a loop creates a new string object. StringBuilder mutates an internal buffer and produces one final string with ToString()—far more efficient for many append operations.

🚀 Common Use Cases

  • Full names and labels — join first name, space, and last name.
  • Building file paths — combine folder and file name segments (consider Path.Combine for paths).
  • Log messages — merge timestamp, level, and message text.
  • Joining array elements — flatten a string[] without separators.
  • CSV-like output — use Join when you need delimiters; Concat when you do not.

🧠 How Concat() Works

1

You pass string pieces

Two strings, a params list, or an IEnumerable collection.

Input
2

Runtime computes total length

Null arguments count as empty. Non-string objects use ToString().

Prepare
3

New string is allocated

Characters are copied in order into one immutable string object.

Build
=

Combined string returned

Assign to a variable, print it, or pass it to another method—originals stay unchanged.

📝 Notes

  • Concat() returns a new string—original arguments are never modified.
  • null arguments become empty strings; they do not produce the text "null".
  • Concat on a string[] joins with no separator—use Join for delimiters.
  • For paths, prefer Path.Combine() over manual concatenation.
  • In loops with many appends, use StringBuilder instead of repeated Concat.
  • The + operator internally uses similar concatenation logic for strings.

⚡ Optimization

Concat() is efficient for a small, fixed number of strings because the runtime can compute the final size once and allocate a single result. Avoid calling Concat() or + on every iteration of a large loop—each call creates a new string and copies prior content. For that pattern, accumulate with StringBuilder or collect pieces in a List<string> and join once at the end with string.Join.

Conclusion

The C# Concat() method is a straightforward way to merge strings into one. It supports multiple overloads for everyday joins and collection-based merging, always returning a new immutable result.

Practice the examples, choose between Concat(), +, and interpolation based on readability, then continue to Contains() for substring search.

💡 Best Practices

✅ Do

  • Use Concat() or Join for array/collection joins
  • Assign the returned string to a variable
  • Use interpolation for readable formatted messages
  • Use StringBuilder in loops with many appends
  • Use Path.Combine for file system paths

❌ Don’t

  • Concatenate in tight loops with + or Concat
  • Expect Concat(array) to insert separators automatically
  • Assume null becomes the literal "null" text
  • Build paths with raw \\ concatenation on all platforms
  • Overuse Concat() when $"..." is clearer

Key Takeaways

Knowledge Unlocked

Five things to remember about Concat()

Use these points whenever you join strings in C#.

5
Core concepts
📄 02

New String

Immutable result.

Return
📚 03

Many Overloads

params & IEnumerable.

API
🔄 04

null → ""

Treated as empty.

Safety
05

StringBuilder

For loop building.

Performance

❓ Frequently Asked Questions

Concat() is a static method that joins two or more strings into one new string. It does not modify the original strings—C# strings are immutable. Call it as string.Concat(a, b) or string.Concat(a, " ", b).
string.Concat(str0, str1) for two strings; overloads accept three or four arguments, a params string[] array, or IEnumerable<T> (each item converted with ToString()). Example: string.Concat("Hello", ", ", "C#");
It returns a new string containing all input pieces joined in order. Original strings are unchanged. Null arguments are treated as empty strings (String.Empty), not as the word "null".
Use + or string interpolation for a few pieces—it is readable. Use Concat() when joining a variable number of strings (params or array overload). Use StringBuilder when building text repeatedly inside a loop to avoid creating many temporary strings.
Yes. Overloads like Concat(object o1, object o2) call ToString() on each argument. Concat<int>(IEnumerable<int> values) works similarly. Null objects become empty strings in the result.
Both produce a new string. Interpolation ($"Hello, {name}") embeds expressions directly in a template and is often clearer for formatted messages. Concat() is explicit about joining existing string variables and works well with arrays or IEnumerable collections.
Did you know?

The C# compiler often optimizes chained + operations on string literals and variables into a single concatenation, similar to Concat(). When you write "Hello" + name + "!", the result is still one new string—the difference is mostly readability and which overload you choose explicitly.

Keep Building C# String Skills

Master string joining with Concat(), then continue to Contains() for searching text.

Next: Contains() →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful