Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Sc #11411

Copy link
Copy link
Open
Open
Sc#11411
Copy link
@Fitzjust4ullc

Description

@Fitzjust4ullc
Issue body actions

Type of issue

Outdated article

Description

[Enter feedback h/ink, Exception.Source, // Exception.StackTrace, and Exception.TargetSite properties. using System; namespace NDP_UE_CS { // Derive an exception; the constructor sets the HelpLink and // Source properties. class LogTableOverflowException : Exception { const string overflowMessage = "The log table has overflowed."; public LogTableOverflowException( string auxMessage, Exception inner ) : base( String.Format( "{0} - {1}", overflowMessage, auxMessage ), inner ) { this.HelpLink = "https://learn.microsoft.com"; this.Source = "Exception_Class_Samples"; } } class LogTable { public LogTable( int numElements ) { logArea = new string[ numElements ]; elemInUse = 0; } protected string[ ] logArea; protected int elemInUse; // The AddRecord method throws a derived exception if // the array bounds exception is caught. public int AddRecord( string newRecord ) { try { logArea[ elemInUse ] = newRecord; return elemInUse++; } catch( Exception e ) { throw new LogTableOverflowException( String.Format( "Record "{0}" was not logged.", newRecord ), e ); } } } class OverflowDemo { // Create a log table and force an overflow. public static void Main() { LogTable log = new LogTable( 4 ); Console.WriteLine( "This example of \n Exception.Message, \n" + " Exception.HelpLink, \n Exception.Source, \n" + " Exception.StackTrace, and \n Exception." + "TargetSite \ngenerates the following output." ); try { for( int count = 1; ; count++ ) { log.AddRecord( String.Format( "Log record number {0}", count ) ); } } catch( Exception ex ) { Console.WriteLine( "\nMessage ---\n{0}", ex.Message ); Console.WriteLine( "\nHelpLink ---\n{0}", ex.HelpLink ); Console.WriteLine( "\nSource ---\n{0}", ex.Source ); Console.WriteLine( "\nStackTrace ---\n{0}", ex.StackTrace ); Console.WriteLine( "\nTargetSite ---\n{0}", ex.TargetSite ); } } } } /* This example of Exception.Message, Exception.HelpLink, Exception.Source, Exception.StackTrace, and Exception.TargetSite generates the following output. Message --- The log table has overflowed. - Record "Log record number 5" was not logged. HelpLink --- https://learn.microsoft.com Source --- Exception_Class_Samples StackTrace --- at NDP_UE_CS.LogTable.AddRecord(String newRecord) at NDP_UE_CS.OverflowDemo.Main() TargetSite --- Int32 AddRecord(System.String) */ere]

Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.io.drivetype?view=net-9.0

Content source URL

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.IO/DriveType.xml

Document Version Independent Id

5e760b46-0c36-d56a-8fd8-13c442e4054a

Platform Id

3eab2a0e-d04d-60fc-7a3a-e3b4f9f7f079

Article author

@dotnet-bot

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-area-labelAn area label is needed to ensure this gets routed to the appropriate area ownersAn area label is needed to ensure this gets routed to the appropriate area ownersneeds-more-infountriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.