C# Strings

String is an array of characters. You are free to use the keyword string for declaring a string variable in C#. The string keyword is System.String class's alias.

C# String Example

Here is an example program, uses string in C# programming:

/* C# String - Example Program */

using System;
namespace StringExample
	class StringClass
		static void Main(string[] args)
			string str1, str2;
			str1 = "Hello";
			str2 = "World";
			string str12 = str1 + str2;
			Console.WriteLine("Complete String = {0}", str12);

When we compile and run the above program, it will produce the following output:

Complete String = HelloWorld

C# Online Test

« Previous Tutorial Next Tutorial »

Like/Share Us on Facebook 😋