In short, something like this:
private void checkMethod()
{
if (textBoxCode.Text.Contains("a").Position(Char.3)))
{
// Then do this...
}
}
In short, something like this:
private void checkMethod()
{
if (textBoxCode.Text.Contains("a").Position(Char.3)))
{
// Then do this...
}
}
If I understand your pseudo code completely. There are many ways, however I guess you could do something like
if(textBoxCode.Text?.Length >= 3 && textBoxCode.Text[2] == 'a')
Calling textBoxCode.Text?.Length
is basic fault tolerance
Or you could use ElementAtOrDefault
, which does all the above
Returns the element at a specified index in a sequence or a default value if the index is out of range.
if(textBoxCode.Text?.ElementAtOrDefault(2) == 'a')