Re: implementing Assert

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Robert Jordan (robertj_at_gmx.net)
Date: 10/15/04


Date: Fri, 15 Oct 2004 20:14:08 +0200

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

>
> 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!!
>
>



Relevant Pages

  • implementing Assert
    ... within the invoked method. ... I need to implement an assert statement ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: SecurityException "Request Failed"
    ... >LinkDemand extremely likely to fail. ... >>Does the invoked method have all the asserted permissions ... The stack walk will hit your assert, ...
    (microsoft.public.dotnet.security)