implementing Assert

  • Thread starter Thread starter Zeng
  • Start date Start date
Z

Zeng

Hi,

I'm wondering if there is a way to capture the line that call a method
within the invoked method. I need to implement an assert statement
checking. For example:

public class Tools
{
static public void Assert( bool bMustBeTrue )
{
if( !bMustBeTrue )
ErrorLog.Output( "This statement is not true:" + ????? ); //
how do I capture "State_X == CurrentState" ? );
}
}


invoking code:
Assert( State_X == CurrentState )


Thanks!!
 
Hi,
I'm wondering if there is a way to capture the line that call a method
within the invoked method. I need to implement an assert statement
checking. For example:

Did you considered System.Diagnostics.Debug.Assert?

bye
Rob
 
Back
Top