c# check if string is only letters and numbers

C#
if (textVar.All(c => Char.IsLetterOrDigit(c))) {
    // String contains only letters & numbers
}
Source

Also in C#: