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
Post a Comment