Craig Johnston Craig Johnston - 3 months ago 13
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.