Craig Johnston Craig Johnston - 9 months ago 69
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.