C#

finally & throw (C#)

Në shqip përdoret i njëjti emër.

ShpjegimiSQ

finally ekzekutohet gjithmonë, me apo pa gabim. Për ta rihedhur një përjashtim, shkruaj throw; (jo throw e;), që të ruhet stack trace origjinal.

EnglishEN

finally always runs, with or without an error. To rethrow an exception, write throw; (not throw e;), so the original stack trace is kept.

Si ta mendosh

Si fikja e dritave në fund të ditës, çfarëdo që të ketë ndodhur.

Lexoje në anglisht

Like switching off the lights at the end of the day, whatever happened.

Shembull kodicsharp

try { Puno(); }
catch (Exception e) { log.LogError(e, "Dështoi"); throw; }
finally { Console.WriteLine("Përfundoi"); }

Terma të lidhur