Home > database >  how to ignore IndexOutOfRangeException?
how to ignore IndexOutOfRangeException?

Time:10-07

i need smt like that : string a = "12345" IF (a[5] == null){ skip error and continue the cycle }

So the questiuon is, how to ignore that type of error?

CodePudding user response:

Make an additional length-check like:

if (a.Length >= 6 && a[5] == null) {}
  •  Tags:  
  • c#
  • Related