CSharp: Strings

adam lee
2 min readDec 18, 2022


C# strings are used to store and manipulate text in the C# programming language. They are represented by the string data type and are immutable, meaning that they cannot be changed once they have been created.

One of the most common uses of strings in C# is to store and display text to the user. For example, you might use a string to store a message that you want to display on the screen, or to store user input that has been entered through a form.

There are several ways to create and manipulate strings in C#. One way is to use string literals, which are string values that are written directly into your code. For example:

string greeting = "Hello, world!";

You can also use the string class to create and manipulate strings. The string class has a number of methods and properties that you can use to perform various operations on strings. For example, you can use the Length property to determine the length of a string, or you can use the ToUpper method to convert a string to uppercase.

You can also use string interpolation to create strings in C#. String interpolation allows you to embed expressions inside a string by using the $ symbol and curly braces. For example:

string name = "John";
string greeting = $"Hello, {name}!";

In this example, the value of the name variable will be inserted into the string where the curly braces are.

There are many more ways to work with strings in C#, and they can be a powerful tool for working with text in your programs. Whether you’re displaying messages to the user, manipulating text data, or working with strings in any other way, C# strings can help you get the job done.

If you would prefer a video walkthrough on the topic, I’ve created some walkthroughs below related to Strings in C#.



adam lee

I'm a martial artist and software engineer. I enjoy writing about Martial Arts, Personal Development, Technology, and Travel.