Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Challenge: Using finally for Cleanup | Fundamentals of Exception Handling
C# Exceptions and Error Handling Practice

bookChallenge: Using finally for Cleanup

Tarefa

Swipe to start coding

Practice using a try-catch-finally structure to simulate resource management and cleanup:

  • In the CleanUpProcess method, print "Resource acquired" at the start of the method.
  • Inside a try block, print "Processing resource" and then throw a System.Exception with the message "Unexpected error".
  • In the catch block, print "Exception handled".
  • In the finally block, print "Resource released".
  • Do not use any file or stream operations; focus only on the flow and printed messages.

Solução

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 6
single

single

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

close

bookChallenge: Using finally for Cleanup

Deslize para mostrar o menu

Tarefa

Swipe to start coding

Practice using a try-catch-finally structure to simulate resource management and cleanup:

  • In the CleanUpProcess method, print "Resource acquired" at the start of the method.
  • Inside a try block, print "Processing resource" and then throw a System.Exception with the message "Unexpected error".
  • In the catch block, print "Exception handled".
  • In the finally block, print "Resource released".
  • Do not use any file or stream operations; focus only on the flow and printed messages.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 6
single

single

some-alt