Differences between "Throw","Throw ex" and "Throw new Exception(...)" in .NET
The T hrow statement is used to inform about the occurrence of an exception when a program is executing. Exceptions contain a property named StackTrace . This string contains the name of the methods on the current call stack, apart from the file name and line number from where the exception was thrown for each method. There are 3 different ways to use the Throw statement: Throw Ex: The original stack trace will be overwritten with a new stack trace that starts from the throwing method. Throw: Preserves the original stack trace information because rethrows the original exception. Throw new Exception(...): Keeps original stack trace and adds aditional details. Example: class Maths { static void Main(string[] args) { try { MethodX();...