C#C
C#3y ago
Livid

✅ try catch

hey for example (i know tryparse exists)
var str1 = "123"
var str2 = "0ab"
var str3 = "65_"

var int1 = Convert.ToInt32(str1)
var int2 = Convert.ToInt32(str2)
var int3 = Convert.ToInt32(str3)

is there a way to seperate the try / catch in a way that if int1 is valid (but int2 and int3 not) that int1 is still set
Was this page helpful?