C# String Characteristics
- It is a reference type.
- It’s immutable( its state cannot be altered).
- It can contain nulls.
- String is one of the reference data type which is derived from the System.String .
- The following code represents the string with a combination of three different data types.
static void Main(string[] args)
{
// Define .NET Strings
// String of characters
System.String authorName = "Mahesh Chand";
// String made of an Integer
System.String age = "33";
// String made of a double
System.String numberString = "33.23";
// Write to Console.
Console.WriteLine("Name: {0}", authorName);
Console.WriteLine("Age: {0}", age);
Console.WriteLine("Number: {0}", numberString);
Console.ReadKey();
No comments