Double.TryParse or Convert.ToDouble - which is faster and safer?

前端 未结 11 1008
滥情空心
滥情空心 2020-11-28 07:28

My application reads an Excel file using VSTO and adds the read data to a StringDictionary. It adds only data that are numbers with a few digits (1000 1000,2 10

11条回答
  •  天命终不由人
    2020-11-28 08:01

    If you aren't going to be handling the exception go with TryParse. TryParse is faster because it doesn't have to deal with the whole exception stack trace.

提交回复
热议问题