Back to Freecodecamp

Create and Throw Exceptions in C# Console Applications

curriculum/challenges/english/blocks/debug-c-sharp-console-applications/647e228a8acb466c97ccbef3.md

latest1.3 KB
Original Source

--description--

This challenge will be partially completed on the Microsoft Learn platform. Follow these instructions to complete the challenge:

  1. Go to <a href="https://learn.microsoft.com/training/modules/create-throw-exceptions-c-sharp/" target="_blank" rel="noreferrer">https://learn.microsoft.com/training/modules/create-throw-exceptions-c-sharp/</a> and complete all the tasks for the "Create and Throw Exceptions in C# Console Applications" module. This is required earn to the "Debug C# Console Applications" trophy on Microsoft Learn, and qualify for the certification exam.
  2. When you are finished, come back and correctly answer the question below.

--assignment--

Complete the <a href="https://learn.microsoft.com/training/modules/create-throw-exceptions-c-sharp/" target="_blank" rel="noreferrer">Create and Throw Exceptions in C# Console Applications</a> module on Microsoft Learn. Then, answer the question below.

--questions--

--text--

When should a method throw an exception?

--answers--

A method should throw an exception when the method can complete its intended purpose.


A method should throw an exception when the method can't complete its intended purpose.


A method should throw an exception when an exception type matches the intended purpose of the method.

--video-solution--

2