Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CompMod / System / Diagnostics / Debug.cs / 1 / Debug.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
*/
#define DEBUG
namespace System.Diagnostics {
using System;
using System.Collections;
using System.Security.Permissions;
using System.Globalization;
///
/// Provides a set of properties and
/// methods
/// for debugging code.
///
public sealed class Debug {
// not creatable...
//
private Debug() {
}
///
/// Gets
/// the collection of listeners that is monitoring the debug
/// output.
///
public static TraceListenerCollection Listeners {
[SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.UnmanagedCode)]
[HostProtection(SharedState=true)]
get {
return TraceInternal.Listeners;
}
}
///
/// Gets or sets a value indicating whether should be called on the
///
/// after every write.
///
public static bool AutoFlush {
[SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.UnmanagedCode)]
get {
return TraceInternal.AutoFlush;
}
[SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.UnmanagedCode)]
set {
TraceInternal.AutoFlush = value;
}
}
///
/// Gets or sets
/// the indent level.
///
public static int IndentLevel {
get { return TraceInternal.IndentLevel; }
set { TraceInternal.IndentLevel = value; }
}
///
/// Gets or sets the number of spaces in an indent.
///
public static int IndentSize {
get { return TraceInternal.IndentSize; }
set { TraceInternal.IndentSize = value; }
}
///
/// Clears the output buffer, and causes buffered data to
/// be written to the .
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Flush() {
TraceInternal.Flush();
}
///
/// Clears the output buffer, and then closes the so that they no longer receive
/// debugging output.
///
[System.Diagnostics.Conditional("DEBUG")]
[SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.UnmanagedCode)]
public static void Close() {
TraceInternal.Close();
}
///
/// Checks for a condition, and outputs the callstack if the condition is .
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Assert(bool condition) {
TraceInternal.Assert(condition);
}
///
/// Checks for a condition, and displays a message if the condition is
/// .
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Assert(bool condition, string message) {
TraceInternal.Assert(condition, message);
}
///
/// Checks for a condition, and displays both the specified messages if the condition
/// is .
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Assert(bool condition, string message, string detailMessage) {
TraceInternal.Assert(condition, message, detailMessage);
}
///
/// Emits or displays a message for an assertion that always fails.
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Fail(string message) {
TraceInternal.Fail(message);
}
///
/// Emits or displays both messages for an assertion that always fails.
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Fail(string message, string detailMessage) {
TraceInternal.Fail(message, detailMessage);
}
[System.Diagnostics.Conditional("DEBUG")]
public static void Print(string message) {
TraceInternal.WriteLine(message);
}
[System.Diagnostics.Conditional("DEBUG")]
public static void Print(string format, params object[] args) {
TraceInternal.WriteLine(String.Format(CultureInfo.InvariantCulture, format, args));
}
///
/// Writes a message to the trace listeners in the collection.
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Write(string message) {
TraceInternal.Write(message);
}
///
/// Writes the name of the value
/// parameter to the trace listeners in the collection.
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Write(object value) {
TraceInternal.Write(value);
}
///
/// Writes a category name and message
/// to the trace listeners in the collection.
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Write(string message, string category) {
TraceInternal.Write(message, category);
}
///
/// Writes a category name and the name of the value parameter to the trace
/// listeners in the collection.
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Write(object value, string category) {
TraceInternal.Write(value, category);
}
///
/// Writes a message followed by a line terminator to the trace listeners in the
/// collection. The default line terminator
/// is a carriage return followed by a line feed (\r\n).
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLine(string message) {
TraceInternal.WriteLine(message);
}
///
/// Writes the name of the value
/// parameter followed by a line terminator to the
/// trace listeners in the collection. The default line
/// terminator is a carriage return followed by a line feed (\r\n).
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLine(object value) {
TraceInternal.WriteLine(value);
}
///
/// Writes a category name and message followed by a line terminator to the trace
/// listeners in the collection. The default line
/// terminator is a carriage return followed by a line feed (\r\n).
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLine(string message, string category) {
TraceInternal.WriteLine(message, category);
}
///
/// Writes a category name and the name of the value
/// parameter followed by a line
/// terminator to the trace listeners in the collection. The
/// default line terminator is a carriage return followed by a line feed (\r\n).
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLine(object value, string category) {
TraceInternal.WriteLine(value, category);
}
///
/// Writes a message to the trace listeners in the collection
/// if a condition is
/// .
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteIf(bool condition, string message) {
TraceInternal.WriteIf(condition, message);
}
///
/// Writes the name of the value
/// parameter to the trace listeners in the
/// collection if a condition is
/// .
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteIf(bool condition, object value) {
TraceInternal.WriteIf(condition, value);
}
///
/// Writes a category name and message
/// to the trace listeners in the
/// collection if a condition is
/// .
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteIf(bool condition, string message, string category) {
TraceInternal.WriteIf(condition, message, category);
}
///
/// Writes a category name and the name of the value
/// parameter to the trace
/// listeners in the collection if a condition is
/// .
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteIf(bool condition, object value, string category) {
TraceInternal.WriteIf(condition, value, category);
}
///
/// Writes a message followed by a line terminator to the trace listeners in the
/// collection if a condition is
/// . The default line terminator is a carriage return followed
/// by a line feed (\r\n).
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLineIf(bool condition, string message) {
TraceInternal.WriteLineIf(condition, message);
}
///
/// Writes the name of the value
/// parameter followed by a line terminator to the
/// trace listeners in the collection if a condition is
/// . The default line terminator is a carriage return followed
/// by a line feed (\r\n).
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLineIf(bool condition, object value) {
TraceInternal.WriteLineIf(condition, value);
}
///
/// Writes a category name and message
/// followed by a line terminator to the trace
/// listeners in the collection if a condition is
/// . The default line terminator is a carriage return followed
/// by a line feed (\r\n).
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLineIf(bool condition, string message, string category) {
TraceInternal.WriteLineIf(condition, message, category);
}
///
/// Writes a category name and the name of the value parameter followed by a line
/// terminator to the trace listeners in the collection
/// if a condition is . The default line terminator is a carriage
/// return followed by a line feed (\r\n).
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLineIf(bool condition, object value, string category) {
TraceInternal.WriteLineIf(condition, value, category);
}
///
/// [To be supplied.]
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Indent() {
TraceInternal.Indent();
}
///
/// [To be supplied.]
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Unindent() {
TraceInternal.Unindent();
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*
*/
#define DEBUG
namespace System.Diagnostics {
using System;
using System.Collections;
using System.Security.Permissions;
using System.Globalization;
///
/// Provides a set of properties and
/// methods
/// for debugging code.
///
public sealed class Debug {
// not creatable...
//
private Debug() {
}
///
/// Gets
/// the collection of listeners that is monitoring the debug
/// output.
///
public static TraceListenerCollection Listeners {
[SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.UnmanagedCode)]
[HostProtection(SharedState=true)]
get {
return TraceInternal.Listeners;
}
}
///
/// Gets or sets a value indicating whether should be called on the
///
/// after every write.
///
public static bool AutoFlush {
[SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.UnmanagedCode)]
get {
return TraceInternal.AutoFlush;
}
[SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.UnmanagedCode)]
set {
TraceInternal.AutoFlush = value;
}
}
///
/// Gets or sets
/// the indent level.
///
public static int IndentLevel {
get { return TraceInternal.IndentLevel; }
set { TraceInternal.IndentLevel = value; }
}
///
/// Gets or sets the number of spaces in an indent.
///
public static int IndentSize {
get { return TraceInternal.IndentSize; }
set { TraceInternal.IndentSize = value; }
}
///
/// Clears the output buffer, and causes buffered data to
/// be written to the .
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Flush() {
TraceInternal.Flush();
}
///
/// Clears the output buffer, and then closes the so that they no longer receive
/// debugging output.
///
[System.Diagnostics.Conditional("DEBUG")]
[SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.UnmanagedCode)]
public static void Close() {
TraceInternal.Close();
}
///
/// Checks for a condition, and outputs the callstack if the condition is .
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Assert(bool condition) {
TraceInternal.Assert(condition);
}
///
/// Checks for a condition, and displays a message if the condition is
/// .
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Assert(bool condition, string message) {
TraceInternal.Assert(condition, message);
}
///
/// Checks for a condition, and displays both the specified messages if the condition
/// is .
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Assert(bool condition, string message, string detailMessage) {
TraceInternal.Assert(condition, message, detailMessage);
}
///
/// Emits or displays a message for an assertion that always fails.
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Fail(string message) {
TraceInternal.Fail(message);
}
///
/// Emits or displays both messages for an assertion that always fails.
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Fail(string message, string detailMessage) {
TraceInternal.Fail(message, detailMessage);
}
[System.Diagnostics.Conditional("DEBUG")]
public static void Print(string message) {
TraceInternal.WriteLine(message);
}
[System.Diagnostics.Conditional("DEBUG")]
public static void Print(string format, params object[] args) {
TraceInternal.WriteLine(String.Format(CultureInfo.InvariantCulture, format, args));
}
///
/// Writes a message to the trace listeners in the collection.
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Write(string message) {
TraceInternal.Write(message);
}
///
/// Writes the name of the value
/// parameter to the trace listeners in the collection.
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Write(object value) {
TraceInternal.Write(value);
}
///
/// Writes a category name and message
/// to the trace listeners in the collection.
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Write(string message, string category) {
TraceInternal.Write(message, category);
}
///
/// Writes a category name and the name of the value parameter to the trace
/// listeners in the collection.
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Write(object value, string category) {
TraceInternal.Write(value, category);
}
///
/// Writes a message followed by a line terminator to the trace listeners in the
/// collection. The default line terminator
/// is a carriage return followed by a line feed (\r\n).
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLine(string message) {
TraceInternal.WriteLine(message);
}
///
/// Writes the name of the value
/// parameter followed by a line terminator to the
/// trace listeners in the collection. The default line
/// terminator is a carriage return followed by a line feed (\r\n).
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLine(object value) {
TraceInternal.WriteLine(value);
}
///
/// Writes a category name and message followed by a line terminator to the trace
/// listeners in the collection. The default line
/// terminator is a carriage return followed by a line feed (\r\n).
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLine(string message, string category) {
TraceInternal.WriteLine(message, category);
}
///
/// Writes a category name and the name of the value
/// parameter followed by a line
/// terminator to the trace listeners in the collection. The
/// default line terminator is a carriage return followed by a line feed (\r\n).
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLine(object value, string category) {
TraceInternal.WriteLine(value, category);
}
///
/// Writes a message to the trace listeners in the collection
/// if a condition is
/// .
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteIf(bool condition, string message) {
TraceInternal.WriteIf(condition, message);
}
///
/// Writes the name of the value
/// parameter to the trace listeners in the
/// collection if a condition is
/// .
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteIf(bool condition, object value) {
TraceInternal.WriteIf(condition, value);
}
///
/// Writes a category name and message
/// to the trace listeners in the
/// collection if a condition is
/// .
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteIf(bool condition, string message, string category) {
TraceInternal.WriteIf(condition, message, category);
}
///
/// Writes a category name and the name of the value
/// parameter to the trace
/// listeners in the collection if a condition is
/// .
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteIf(bool condition, object value, string category) {
TraceInternal.WriteIf(condition, value, category);
}
///
/// Writes a message followed by a line terminator to the trace listeners in the
/// collection if a condition is
/// . The default line terminator is a carriage return followed
/// by a line feed (\r\n).
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLineIf(bool condition, string message) {
TraceInternal.WriteLineIf(condition, message);
}
///
/// Writes the name of the value
/// parameter followed by a line terminator to the
/// trace listeners in the collection if a condition is
/// . The default line terminator is a carriage return followed
/// by a line feed (\r\n).
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLineIf(bool condition, object value) {
TraceInternal.WriteLineIf(condition, value);
}
///
/// Writes a category name and message
/// followed by a line terminator to the trace
/// listeners in the collection if a condition is
/// . The default line terminator is a carriage return followed
/// by a line feed (\r\n).
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLineIf(bool condition, string message, string category) {
TraceInternal.WriteLineIf(condition, message, category);
}
///
/// Writes a category name and the name of the value parameter followed by a line
/// terminator to the trace listeners in the collection
/// if a condition is . The default line terminator is a carriage
/// return followed by a line feed (\r\n).
///
[System.Diagnostics.Conditional("DEBUG")]
public static void WriteLineIf(bool condition, object value, string category) {
TraceInternal.WriteLineIf(condition, value, category);
}
///
/// [To be supplied.]
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Indent() {
TraceInternal.Indent();
}
///
/// [To be supplied.]
///
[System.Diagnostics.Conditional("DEBUG")]
public static void Unindent() {
TraceInternal.Unindent();
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- VisualStyleElement.cs
- SelectingProviderEventArgs.cs
- DispatcherOperation.cs
- RightsManagementEncryptedStream.cs
- XmlWrappingReader.cs
- IPAddress.cs
- SplashScreen.cs
- KernelTypeValidation.cs
- DataGridViewMethods.cs
- ProcessProtocolHandler.cs
- ModifierKeysValueSerializer.cs
- SeverityFilter.cs
- RowBinding.cs
- DBCommand.cs
- SourceFileBuildProvider.cs
- ItemsPanelTemplate.cs
- ReferenceConverter.cs
- AlternationConverter.cs
- XpsSerializationException.cs
- ProtocolElement.cs
- LinkedDataMemberFieldEditor.cs
- SinglePhaseEnlistment.cs
- ToolStripProgressBar.cs
- FontEmbeddingManager.cs
- EmptyCollection.cs
- XmlSchemaType.cs
- DataGridViewCheckBoxColumn.cs
- PropertyMapper.cs
- ImageKeyConverter.cs
- StagingAreaInputItem.cs
- PropertyItem.cs
- XmlSerializerFactory.cs
- SqlNode.cs
- PageCodeDomTreeGenerator.cs
- TableAdapterManagerHelper.cs
- XmlSchemaObjectCollection.cs
- ToolStripManager.cs
- TypeSystemHelpers.cs
- IndexOutOfRangeException.cs
- DeviceContext.cs
- SoapRpcServiceAttribute.cs
- DrawingCollection.cs
- SQLByte.cs
- HostDesigntimeLicenseContext.cs
- dataobject.cs
- COM2EnumConverter.cs
- DrawingBrush.cs
- XPathSelectionIterator.cs
- WebGetAttribute.cs
- SizeF.cs
- ToolStripPanel.cs
- ParserContext.cs
- ValueUnavailableException.cs
- UIPermission.cs
- PageBuildProvider.cs
- XmlReflectionMember.cs
- ServiceAppDomainAssociationProvider.cs
- Drawing.cs
- ZipIOExtraFieldZip64Element.cs
- TextTrailingCharacterEllipsis.cs
- CalendarDay.cs
- WSSecureConversation.cs
- MouseActionConverter.cs
- XmlResolver.cs
- Utils.cs
- StoreUtilities.cs
- CachedRequestParams.cs
- WebPartEditorOkVerb.cs
- SponsorHelper.cs
- MemberHolder.cs
- URLAttribute.cs
- ComboBoxAutomationPeer.cs
- ScrollItemProviderWrapper.cs
- MediaContextNotificationWindow.cs
- DataBindEngine.cs
- SafeArrayRankMismatchException.cs
- FindCriteriaApril2005.cs
- PackageStore.cs
- ItemCheckedEvent.cs
- UrlMappingsModule.cs
- FormViewModeEventArgs.cs
- XhtmlTextWriter.cs
- VisualProxy.cs
- GeneralTransform3DTo2DTo3D.cs
- NumericUpDownAccelerationCollection.cs
- CustomValidator.cs
- SqlRowUpdatingEvent.cs
- Table.cs
- AutomationAttributeInfo.cs
- JoinGraph.cs
- SerialReceived.cs
- ForwardPositionQuery.cs
- SmiRequestExecutor.cs
- ItemCheckEvent.cs
- ColumnHeaderConverter.cs
- FunctionDefinition.cs
- PropertyBuilder.cs
- CurrentChangedEventManager.cs
- Int32Rect.cs
- OleDbCommandBuilder.cs