C# - failed parse exception?

后端 未结 10 1388
春和景丽
春和景丽 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 07:48

    Depends on what you're using to do the conversion. For example, int.Parse will throw ArgumentNullException, FormatException, or OverflowException. Odds are it's ArgumentNullException you're looking for, but if that's an empty string rather than a null reference, it's probably going to be FormatException

提交回复
热议问题