Tag Archives: exceptions

A quick note on error messages

I went to a local museum the other day and when the attendant scanned by membership card his computer said: Object not set to a reference of an object. Because we’re programmers, you and I know what that means (more … Continue reading

Posted in MessageBox, miscellany, user interface | Tagged , , , , , , , , , , , , , | 1 Comment

Define custom exception classes in C#

The example Throw a standard exception in C# explains how to throw exceptions to tell the program about unexpected errors. The example See a hierarchy of exception classes for use in C# lists some useful exception classes. But what if … Continue reading

Posted in coding | Tagged , , , , , , , , , , , , , | Leave a comment

Throw standard exceptions in C#

The example Use try catch blocks to protect against unexpected errors in C# explains how to catch an exception and briefly mentions that you can use the throw statement to throw your own exception. This example shows how to throw … Continue reading

Posted in coding | Tagged , , , , , , , , , , , | 2 Comments

See how much time a checked block takes in C#

The post Control overflow behavior with checked and unchecked in C# explains how to use checked blocks to watch for integer overflow. If you don’t use checked, the program may encounter integer overflow errors without you knowing it. It seems … Continue reading

Posted in calculations, mathematics, performance, syntax | Tagged , , , , , , , , , , , , , , , | Leave a comment

Control overflow behavior with checked and unchecked in C#

C# handles overflow with different data types differently. You can control this to some extent with the checked and unchecked keywords. If you execute code inside a checked block and an int or long operation causes an overflow, the block … Continue reading

Posted in calculations, mathematics, syntax | Tagged , , , , , , , , , , , , , | 1 Comment