How to get first five characters from a string in C#
To get the first five characters from a string we can use the
Substring() method by passing the
0,5 as an arguments.
Here is an example that gets the first 5 characters from a given string
string mystring = "Hellopeople"; string firstFive = mystring.Substring(0,5); Console.WriteLine(firstFive);