05 Feb C# – Strings
The string type in C# is used to store a sequence of characters, for example, amit, john, sachin, etc. Declare a string variable using the string keyword. The string variable value is surrounded by double quotes.
Create a String
To create a String, use the string keyword. This declares a string. Let us see an example to declare and initialize a string:
using System;
namespace Demo
{
class Studyopedia
{
static void Main(string[] args)
{
// string variable
string s = "Jack";
Console.WriteLine("Favourite Actor = {0}", s);
}
}
}
Output
Favourite Actor = Jack
No Comments