65.9K
CodeProject is changing. Read more.
Home

Returning a value or throwing an exception

starIconemptyStarIconemptyStarIconemptyStarIconemptyStarIcon

1.00/5 (1 vote)

May 6, 2010

CPOL

2 min read

viewsIcon

7005

The other day my colleague was probing around whether to return a value or to throw an exception in general scenarios and I initially told him that throwing exceptions almost always incur performance costs as compared to a returned value. We had then left the discussion there itself but...