S
Steve B.
Hi,
I'm wondering when does Debug.Assert is pertinent to use.
For the moment, I think it is used to ensure something is true, as it is
supposed to be always true.
For example, I query a DB to get the only one customer's detail rows.
If I get any exception, it is an runtime error..So I use try/catch/throw
blocks.
If I get 0 rows, it is a business error, so I throw a business exception.
If I get 1 row, it's ok and I return it.
If I get 2 or more row, it's a supposed-impossible case, but I use
Debug.Assert to check it actually does not occurs. If it occurs, it should
help me debug the application.
Am I on the right way ?
Steve
I'm wondering when does Debug.Assert is pertinent to use.
For the moment, I think it is used to ensure something is true, as it is
supposed to be always true.
For example, I query a DB to get the only one customer's detail rows.
If I get any exception, it is an runtime error..So I use try/catch/throw
blocks.
If I get 0 rows, it is a business error, so I throw a business exception.
If I get 1 row, it's ok and I return it.
If I get 2 or more row, it's a supposed-impossible case, but I use
Debug.Assert to check it actually does not occurs. If it occurs, it should
help me debug the application.
Am I on the right way ?
Steve