Checks for a condition and displays both the specified messages if the condition is false.
[Visual Basic] Overloads Public Shared Sub Assert( _ ByVal condition As Boolean, _ ByVal message As String, _ ByVal detailMessage As String _ ) [C#] public static void Assert( bool condition, string message, string detailMessage ); [C++] public: static void Assert( bool condition, String* message, String* detailMessage ); [JScript] public static function Assert( condition : Boolean, message : String, detailMessage : String );
Typically Assert is used to identify logic errors during program development. Assert will evaluate the condition. If the result is false, it sends diagnostic messages to the Listeners.The default behavior is to display a message box when the application is running in a user interface mode, and to output the message to the default trace output. You can customize this behavior by adding a TraceListener to or removing one from the Listeners collection.
Trace Class | Trace Members | System.Diagnostics Namespace | Trace.Assert Overload List | Debug | Trace | BooleanSwitch | TraceSwitch | TraceListener | DefaultTraceListener | ConditionalAttribute