C# Strings

« Previous Tutorial Next Tutorial »

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

« Previous Tutorial Next Tutorial »


Quick Links
Signup - Login - Give Online Test