C# - failed parse exception?

后端 未结 10 1333
春和景丽
春和景丽 2021-02-19 07:35

I am writing a program in C#, and I want to catch exceptions caused by converting \"\" (null) to int. What is the exception\'s name?

EDIT: I\'m not sur

10条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-19 08:05

    You are going to get a FormatException if a parse fails. Why not use int.TryParse instead?

提交回复
热议问题