C# TutorialLesson 13Free preview
C# Strings
This lesson is part of C# · All levels
Summary
Strings are immutable text storage objects, meaning their value cannot be changed in place. C# provides many built-in methods such as Length, ToUpper, Substring, IndexOf, and Split. Text writing can be done using a regular string, a verbatim string, or a string interpolation starting with a dollar sign.
Key points
- String immutable: methods like ToUpper do not change the original string but return the new string.
- Popular methods: Length, ToUpper, ToLower, Trim, Substring, IndexOf, Contains, and Split.
- String interpolation makes it easy to mix text and variables into a single piece of code.
- The verbatim string treats the backslash as a normal character so it fits the file path.
- Combination can be done with the plus operator or String.Join for many pieces of text.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.