Exception Handling

Top  Previous  Next

What is translated > Exception Handling

Delphi and C# use similar exception concepts, but their type systems are not identical. In Delphi, exception classes are ordinary classes derived from TObject, usually through SysUtils.Exception. In C#, however, only objects derived from System.Exception can be thrown and caught as exceptions.

 

For this reason, Delphi2C# translates Delphi exception classes to classes derived from DException, where DException itself derives from System.Exception.

 

public class DException : global::System.Exception

{

}

 

This allows translated exceptions to work naturally with C# throw, try, catch, and finally statements.

 



This page belongs to the Delphi2C# Documentation

Delphi2C# home  Content