Unhandled exception bubble up until they are exposed to the end user (aka “yellow screen of death”) Best place to handle exception is the nearest locale to the exception itself. However, You CAN handlig globally. In global.asax Understanding Custom Exceptions Inherit from Exception like so:
Author Archives: Deniz Karadal
C# – Understanding Exception Handling
Wrap try …… catch around code: That you are calling into you did not write Code that accesses external recources Code that accepts input from outer sources
C# – First Pass at the Separation of Concern Principle
Separate concers at the mitigate the impact of change on a software system. Common “concerns”: Presentation logic Business / Domain logic Persistence logic Recommendation: Seperate concerns into projects within a given solution. Naming convention: MyApplication(Solution name) MyApplication.Presentation(.Web, etc. presentation project) MyApplication.Domain(domain/business rules project) MyApplication.Persistence(.Data, .DB persistence project)
C# – Understanding the Switch Statement
Think: train switch… logic based on evaluation of a variable or property value.
C# – Creating Constants with the const Keyword
Remove magic values (strings, integers, etc) using permanent, immutable identifiers. Only use for things that NEVER change – not for product prices, etc. Define const at local or field.