C Sharp Debugging and Exception Handling Tutorial Videos for Beginner - PowerPoint PPT Presentation

Loading...

PPT – C Sharp Debugging and Exception Handling Tutorial Videos for Beginner PowerPoint presentation | free to download - id: 84e533-M2QzM



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

C Sharp Debugging and Exception Handling Tutorial Videos for Beginner

Description:

Our C sharp Debugging and Exception tutorial covers runtime exceptions, exception handling,try/catch/finally statements briefly. Also provides various free C sharp resources for beginners – PowerPoint PPT presentation

Number of Views:7

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: C Sharp Debugging and Exception Handling Tutorial Videos for Beginner


1
CATCH EXPERTS
https//www.catchexperts.com
http//www.courseing.com
2
C Debugging and Exception Handling Tutorial
Videos for Beginners by
3
Highlights
  • Understanding runtime exceptions
  • Debugging exceptions
  • Handling exceptions with try/catch
  • Multiple catch statements
  • Cleaning up with finally

4
Understanding runtime exceptions
  • Runtime errors meant for errors occur when a
    program is running.
  • Exceptions would be generated by the common
    language runtime (CLR).
  • Exceptions can also be generate by .NET Framework
    or third-party libraries, or by application code.
  • Exceptions are created by using
    the throw keyword.
  • Exceptions derive from System.Exception
  • Exception objects contain detailed information
    about the error.

5
Debugging exceptions
  •  Use the Exception Settings to specify which
    exceptions will cause the debugger to break.
  •  WE can add or delete exceptions or specify
    exceptions.
  • Check Debug / Windows / Exception Settings.
  • discover particular exceptions by using
    Search window in the Exception
    settings toolbar.
  • Debugger can break execution where an exception
    is thrown.

6
Handling exceptions with try/catch
  • Try-catch statement consists of a try block
    followed by one or more catch clauses, which
    specify handlers for different exceptions.  
  • Try block is used by C programmers to partition
    code that might be affected by an exception.
    Catch blocks are used to handle any resulting
    exceptions.
  • When an exception is thrown, the common language
    runtime (CLR) looks for the catch statement that
    handles this exception.
  • Catch block is a series of statements, begins
    with the keyword catch, followed by an exception
    type and an action to be taken.

7
Handling exceptions with try/catch
  • Syntax for try/catch statements
  • try
  • StreamReader tu File.OpenText("data.txt")
  • Console.WriteLine("The first line of this file is
    0", tu.ReadLine())
  • tu.Close()
  • catch (Exception e)
  • Console.WriteLine("An error occurred '0'", e)

8
Multiple catch statements
  • We can mention multiple catch blocks associated
    with one try block.
  • Only single catch block can ever handle exception
    thrown by try block.
  • Which catch block matches the exception type is
    only get executed.
  • Syntax try
  • catch (IOException exp1) // Block 1
  • catch (Exception exp2) // Block 2

9
Cleaning up with finally
  • finally block clean up all resources that are
    allocated in a try block.
  • Executes code even if an exception occurs in
    the try block.
  • finally block run when control leaves
    a try statement.
  • Syntax try
  • ... // Code that might generate error ...

10
Cleaning up with finally
  • catch (ExceptionType1 e1)...
  • catch (ExceptionType2 e2)...
  • finally
  • // Always executed, whether try terminates
    normally or ... // exceptionally. Use for cleanup
    statements

11
Feedback
Like It ? Hate It?
We would love to hear from you whatever you think
about the course.
Click HERE to share what you think!
12
Thank you
Thank You for Watching C Debugging and Exception
Handling Tutorial Videos for Beginner by
http//www.courseing.com
About PowerShow.com