c# - Should I use Exception Handling or Check the values -


i need conceptual problem.

essentially, have data known source. know of data can potentially not have value. have 2 options.

option 1: can check of data before stored prevent invalid cast exceptions

option 2: can let throw exception.

now know fact best practice use proactive error handling method , check nulls; however, sure out of million mappings tables objects have no more 2 errors. should throw exception or check?

people check because exception takes more resources simple check; however, case when need on million checks verses 1 exception?

exceptions should used in exceptional cases. 2 out of million sounds exceptional me.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -