String
In C#, you can use strings as array of characters, However, more common practice is to use the string keyword to declare a string variable. The string keyword is an alias for the System.String class.
The Code:

The Output of Your Program:

Working with Strings
Let’s create a program that will take a string, replace all occurrences of the word “dog” with “cat” and output the first sentence only.
The Code:

The Output of Your Program:

The code above replaces all occurrences of “dog” with “cat”. After that it takes a substring of the original string starting from the first index until the first occurrence of a period character.
We add one to the index of the period to include the period in the substring.
C# provides a solid collection of tools and methods to work and manipulate strings. You could, for example, find the number of times a specific word appears in a book with ease, using those methods.
