Data Types
Strings and Chars
A string stores text, while a char stores one character.
Strings and Chars
StringsChars.cs
using System;
class Program
{
static void Main()
{
string word = ;
char first = word[0];
int length = word.Length;
Console.WriteLine($"word={word}");
Console.WriteLine($"first={first}");
Console.WriteLine($"length={length}");
}
}
using System;
class Program
{
static void Main()
{
string word = ;
char first = word[0];
int length = word.Length;
Console.WriteLine($"word={word}");
Console.WriteLine($"first={first}");
Console.WriteLine($"length={length}");
}
}
using System;
class Program
{
static void Main()
{
string word = ;
char first = word[0];
int length = word.Length;
Console.WriteLine($"word={word}");
Console.WriteLine($"first={first}");
Console.WriteLine($"length={length}");
}
}
string
A string is a sequence of characters.