Craig Johnston Craig Johnston - 4 months ago 22
C# Question

C#: how to get first char of a string?

Can the first

char
of a string be retrieved by doing the following?

MyString.ToCharArray[0]

Answer

Just MyString[0]. This uses the String.Chars indexer.